son-logic-engine 0.2.2__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {son_logic_engine-0.2.2 → son_logic_engine-0.2.4}/Cargo.lock +1 -1
- {son_logic_engine-0.2.2 → son_logic_engine-0.2.4}/Cargo.toml +1 -1
- son_logic_engine-0.2.4/PKG-INFO +51 -0
- son_logic_engine-0.2.4/README.md +42 -0
- son_logic_engine-0.2.4/encoding_map.json +29 -0
- {son_logic_engine-0.2.2 → son_logic_engine-0.2.4}/pyproject.toml +1 -1
- {son_logic_engine-0.2.2 → son_logic_engine-0.2.4}/src/lib.rs +3 -3
- son_logic_engine-0.2.2/PKG-INFO +0 -14
- son_logic_engine-0.2.2/README.md +0 -5
- son_logic_engine-0.2.2/encoding_map.json +0 -150
- {son_logic_engine-0.2.2 → son_logic_engine-0.2.4}/sample_data/README.md +0 -0
- {son_logic_engine-0.2.2 → son_logic_engine-0.2.4}/sample_data/anscombe.json +0 -0
- {son_logic_engine-0.2.2 → son_logic_engine-0.2.4}/sample_data/california_housing_test.csv +0 -0
- {son_logic_engine-0.2.2 → son_logic_engine-0.2.4}/sample_data/california_housing_train.csv +0 -0
- {son_logic_engine-0.2.2 → son_logic_engine-0.2.4}/sample_data/mnist_test.csv +0 -0
- {son_logic_engine-0.2.2 → son_logic_engine-0.2.4}/sample_data/mnist_train_small.csv +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: son_logic_engine
|
|
3
|
+
Version: 0.2.4
|
|
4
|
+
Summary: High-performance Rust search engine for RAG systems
|
|
5
|
+
Author-email: Son <sonbuwin@gmail.com>
|
|
6
|
+
Requires-Python: >=3.7
|
|
7
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
8
|
+
|
|
9
|
+
# son-logic-engine
|
|
10
|
+
|
|
11
|
+
High-performance search filter for RAG systems written in Rust, designed for speed and accuracy with Vietnamese text.
|
|
12
|
+
|
|
13
|
+
## 🚀 Features
|
|
14
|
+
- **Rust Core:** Blazing fast processing for large datasets.
|
|
15
|
+
- **Polymorphic Input:** Supports `List[str]`, `Dict`, or nested `List[Dict]`.
|
|
16
|
+
- **Field Filtering:** Optimize search speed by targeting specific columns.
|
|
17
|
+
- **Unicode Support:** Native handling of Vietnamese characters and custom character mappings.
|
|
18
|
+
|
|
19
|
+
## 🛠 Installation
|
|
20
|
+
```bash
|
|
21
|
+
pip install son-logic-engine
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 📖 API Reference
|
|
25
|
+
|
|
26
|
+
### 1. `load_mapping(path: str)`
|
|
27
|
+
Loads the character weight mapping from a JSON file. This is required for the search logic to compute character-based relevance.
|
|
28
|
+
```python
|
|
29
|
+
import son_logic_engine as slg
|
|
30
|
+
mapping = slg.load_mapping('path/to/mapping.json')
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 2. `loc(query: str, database: Any, mapping: dict, field_name: str = None)`
|
|
34
|
+
The core search function. Returns a list of records (as JSON strings) ranked by relevance to the query.
|
|
35
|
+
- `query`: The search term.
|
|
36
|
+
- `database`: Your data (List of strings or List of Dictionaries).
|
|
37
|
+
- `mapping`: The mapping object from `load_mapping`.
|
|
38
|
+
- `field_name`: (Optional) The specific key in your dictionary to search within.
|
|
39
|
+
|
|
40
|
+
### 3. `print(raw_results: list)`
|
|
41
|
+
A utility function to decode and pretty-print the JSON results returned by `loc`.
|
|
42
|
+
```python
|
|
43
|
+
results = slg.loc("search term", data, mapping)
|
|
44
|
+
slg.print(results)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 🔒 Security & Contact
|
|
48
|
+
The underlying search algorithm and character weight logic are proprietary. For access to standard mapping files or custom integration, please contact:
|
|
49
|
+
|
|
50
|
+
📩 **Email:** sonbuwin@gmail.com
|
|
51
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# son-logic-engine
|
|
2
|
+
|
|
3
|
+
High-performance search filter for RAG systems written in Rust, designed for speed and accuracy with Vietnamese text.
|
|
4
|
+
|
|
5
|
+
## 🚀 Features
|
|
6
|
+
- **Rust Core:** Blazing fast processing for large datasets.
|
|
7
|
+
- **Polymorphic Input:** Supports `List[str]`, `Dict`, or nested `List[Dict]`.
|
|
8
|
+
- **Field Filtering:** Optimize search speed by targeting specific columns.
|
|
9
|
+
- **Unicode Support:** Native handling of Vietnamese characters and custom character mappings.
|
|
10
|
+
|
|
11
|
+
## 🛠 Installation
|
|
12
|
+
```bash
|
|
13
|
+
pip install son-logic-engine
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 📖 API Reference
|
|
17
|
+
|
|
18
|
+
### 1. `load_mapping(path: str)`
|
|
19
|
+
Loads the character weight mapping from a JSON file. This is required for the search logic to compute character-based relevance.
|
|
20
|
+
```python
|
|
21
|
+
import son_logic_engine as slg
|
|
22
|
+
mapping = slg.load_mapping('path/to/mapping.json')
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. `loc(query: str, database: Any, mapping: dict, field_name: str = None)`
|
|
26
|
+
The core search function. Returns a list of records (as JSON strings) ranked by relevance to the query.
|
|
27
|
+
- `query`: The search term.
|
|
28
|
+
- `database`: Your data (List of strings or List of Dictionaries).
|
|
29
|
+
- `mapping`: The mapping object from `load_mapping`.
|
|
30
|
+
- `field_name`: (Optional) The specific key in your dictionary to search within.
|
|
31
|
+
|
|
32
|
+
### 3. `print(raw_results: list)`
|
|
33
|
+
A utility function to decode and pretty-print the JSON results returned by `loc`.
|
|
34
|
+
```python
|
|
35
|
+
results = slg.loc("search term", data, mapping)
|
|
36
|
+
slg.print(results)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 🔒 Security & Contact
|
|
40
|
+
The underlying search algorithm and character weight logic are proprietary. For access to standard mapping files or custom integration, please contact:
|
|
41
|
+
|
|
42
|
+
📩 **Email:** sonbuwin@gmail.com
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"a": 0.1,
|
|
3
|
+
"b": 0.2,
|
|
4
|
+
"c": 0.3,
|
|
5
|
+
"d": 0.4,
|
|
6
|
+
"e": 0.5,
|
|
7
|
+
"f": 0.6,
|
|
8
|
+
"g": 0.7,
|
|
9
|
+
"h": 0.8,
|
|
10
|
+
"i": 0.9,
|
|
11
|
+
"j": 1.0,
|
|
12
|
+
"k": 1.1,
|
|
13
|
+
"l": 1.2,
|
|
14
|
+
"m": 1.3,
|
|
15
|
+
"n": 1.4,
|
|
16
|
+
"o": 1.5,
|
|
17
|
+
"p": 1.6,
|
|
18
|
+
"q": 1.7,
|
|
19
|
+
"r": 1.8,
|
|
20
|
+
"s": 1.9,
|
|
21
|
+
"t": 2.0,
|
|
22
|
+
"u": 2.1,
|
|
23
|
+
"v": 2.2,
|
|
24
|
+
"w": 2.3,
|
|
25
|
+
"x": 2.4,
|
|
26
|
+
"y": 2.5,
|
|
27
|
+
"z": 2.6,
|
|
28
|
+
" ": 0.0
|
|
29
|
+
}
|
|
@@ -5,7 +5,7 @@ build-backend = "maturin"
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "son_logic_engine"
|
|
8
|
-
version = "0.2.2
|
|
8
|
+
version = "0.2.4" # Tạm thời để 0.2.3, sẽ được cập nhật lên 0.2.4
|
|
9
9
|
description = "High-performance Rust search engine for RAG systems"
|
|
10
10
|
authors = [{name = "Son", email = "sonbuwin@gmail.com"}]
|
|
11
11
|
readme = "README.md"
|
|
@@ -20,7 +20,7 @@ fn load_mapping(path: String) -> PyResult<HashMap<char, f64>> {
|
|
|
20
20
|
// Hàm helper mới: Trả về (Nội dung để search, Toàn bộ Object dưới dạng JSON String)
|
|
21
21
|
fn process_item_full(item: &Bound<'_, PyAny>, field_name: &Option<String>, flat_db: &mut Vec<(String, String)>) {
|
|
22
22
|
let py = item.py();
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
// Nếu là Dictionary
|
|
25
25
|
if let Ok(dict_obj) = item.extract::<HashMap<String, Bound<'_, PyAny>>>() {
|
|
26
26
|
// Convert toàn bộ dict sang JSON string để lưu trữ
|
|
@@ -35,14 +35,14 @@ fn process_item_full(item: &Bound<'_, PyAny>, field_name: &Option<String>, flat_
|
|
|
35
35
|
// Nếu không chọn field, gộp toàn bộ text trong dict để search
|
|
36
36
|
let mut all_text = String::new();
|
|
37
37
|
for (_, val) in dict_obj {
|
|
38
|
-
if let Ok(s) = val.extract::<String>() {
|
|
38
|
+
if let Ok(s) = val.extract::<String>() {
|
|
39
39
|
all_text.push_str(&s);
|
|
40
40
|
all_text.push(' ');
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
flat_db.push((all_text, full_json));
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
// Nếu là List
|
|
47
47
|
else if let Ok(list_any) = item.extract::<Vec<Bound<'_, PyAny>>>() {
|
|
48
48
|
for sub_item in list_any {
|
son_logic_engine-0.2.2/PKG-INFO
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: son_logic_engine
|
|
3
|
-
Version: 0.2.2
|
|
4
|
-
Summary: High-performance Rust search engine for RAG systems
|
|
5
|
-
Author-email: Son <sonbuwin@gmail.com>
|
|
6
|
-
Requires-Python: >=3.7
|
|
7
|
-
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
8
|
-
|
|
9
|
-
# son-logic-engine
|
|
10
|
-
|
|
11
|
-
High-performance search filter for RAG systems written in Rust.
|
|
12
|
-
|
|
13
|
-
Contact sonbuwin@gmail.com for mapping files.
|
|
14
|
-
|
son_logic_engine-0.2.2/README.md
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"a": 1.0,
|
|
3
|
-
"b": 2.0,
|
|
4
|
-
"c": 3.0,
|
|
5
|
-
"d": 4.0,
|
|
6
|
-
"e": 5.0,
|
|
7
|
-
"f": 6.0,
|
|
8
|
-
"g": 7.0,
|
|
9
|
-
"h": 8.0,
|
|
10
|
-
"i": 9.0,
|
|
11
|
-
"j": 10.0,
|
|
12
|
-
"k": 11.0,
|
|
13
|
-
"l": 12.0,
|
|
14
|
-
"m": 13.0,
|
|
15
|
-
"n": 14.0,
|
|
16
|
-
"o": 15.0,
|
|
17
|
-
"p": 16.0,
|
|
18
|
-
"q": 17.0,
|
|
19
|
-
"r": 18.0,
|
|
20
|
-
"s": 19.0,
|
|
21
|
-
"t": 20.0,
|
|
22
|
-
"u": 21.0,
|
|
23
|
-
"v": 22.0,
|
|
24
|
-
"w": 23.0,
|
|
25
|
-
"x": 24.0,
|
|
26
|
-
"y": 25.0,
|
|
27
|
-
"z": 26.0,
|
|
28
|
-
"A": 27.0,
|
|
29
|
-
"B": 28.0,
|
|
30
|
-
"C": 29.0,
|
|
31
|
-
"D": 30.0,
|
|
32
|
-
"E": 31.0,
|
|
33
|
-
"F": 32.0,
|
|
34
|
-
"G": 33.0,
|
|
35
|
-
"H": 34.0,
|
|
36
|
-
"I": 35.0,
|
|
37
|
-
"J": 36.0,
|
|
38
|
-
"K": 37.0,
|
|
39
|
-
"L": 38.0,
|
|
40
|
-
"M": 39.0,
|
|
41
|
-
"N": 40.0,
|
|
42
|
-
"O": 41.0,
|
|
43
|
-
"P": 42.0,
|
|
44
|
-
"Q": 43.0,
|
|
45
|
-
"R": 44.0,
|
|
46
|
-
"S": 45.0,
|
|
47
|
-
"T": 46.0,
|
|
48
|
-
"U": 47.0,
|
|
49
|
-
"V": 48.0,
|
|
50
|
-
"W": 49.0,
|
|
51
|
-
"X": 50.0,
|
|
52
|
-
"Y": 51.0,
|
|
53
|
-
"Z": 52.0,
|
|
54
|
-
"0": 53.0,
|
|
55
|
-
"1": 54.0,
|
|
56
|
-
"2": 55.0,
|
|
57
|
-
"3": 56.0,
|
|
58
|
-
"4": 57.0,
|
|
59
|
-
"5": 58.0,
|
|
60
|
-
"6": 59.0,
|
|
61
|
-
"7": 60.0,
|
|
62
|
-
"8": 61.0,
|
|
63
|
-
"9": 62.0,
|
|
64
|
-
"!": 63.0,
|
|
65
|
-
"\"": 64.0,
|
|
66
|
-
"#": 65.0,
|
|
67
|
-
"$": 66.0,
|
|
68
|
-
"%": 67.0,
|
|
69
|
-
"&": 68.0,
|
|
70
|
-
"'": 69.0,
|
|
71
|
-
"(": 70.0,
|
|
72
|
-
")": 71.0,
|
|
73
|
-
"*": 72.0,
|
|
74
|
-
"+": 73.0,
|
|
75
|
-
",": 74.0,
|
|
76
|
-
"-": 75.0,
|
|
77
|
-
".": 76.0,
|
|
78
|
-
"/": 77.0,
|
|
79
|
-
":": 78.0,
|
|
80
|
-
";": 79.0,
|
|
81
|
-
"<": 80.0,
|
|
82
|
-
"=": 81.0,
|
|
83
|
-
">": 82.0,
|
|
84
|
-
"?": 83.0,
|
|
85
|
-
"@": 84.0,
|
|
86
|
-
"[": 85.0,
|
|
87
|
-
"\\": 86.0,
|
|
88
|
-
"]": 87.0,
|
|
89
|
-
"^": 88.0,
|
|
90
|
-
"_": 89.0,
|
|
91
|
-
"`": 90.0,
|
|
92
|
-
"{": 91.0,
|
|
93
|
-
"|": 92.0,
|
|
94
|
-
"}": 93.0,
|
|
95
|
-
"~": 94.0,
|
|
96
|
-
" ": 95.0,
|
|
97
|
-
"̑": 96.0,
|
|
98
|
-
"̆": 97.0,
|
|
99
|
-
"̂": 98.0,
|
|
100
|
-
"đ": 99.0,
|
|
101
|
-
"̀": 100.0,
|
|
102
|
-
"́": 101.0,
|
|
103
|
-
"̉": 102.0,
|
|
104
|
-
"̃": 103.0,
|
|
105
|
-
"̣": 104.0,
|
|
106
|
-
"̛": 105.0,
|
|
107
|
-
"→": 106.0,
|
|
108
|
-
"⇒": 107.0,
|
|
109
|
-
"∑": 108.0,
|
|
110
|
-
"≈": 109.0,
|
|
111
|
-
"≠": 110.0,
|
|
112
|
-
"≤": 111.0,
|
|
113
|
-
"≥": 112.0,
|
|
114
|
-
"∆": 113.0,
|
|
115
|
-
"∞": 114.0,
|
|
116
|
-
"∫": 115.0,
|
|
117
|
-
"π": 116.0,
|
|
118
|
-
"±": 117.0,
|
|
119
|
-
"×": 118.0,
|
|
120
|
-
"÷": 119.0,
|
|
121
|
-
"√": 120.0,
|
|
122
|
-
"∂": 121.0,
|
|
123
|
-
"µ": 122.0,
|
|
124
|
-
"€": 123.0,
|
|
125
|
-
"£": 124.0,
|
|
126
|
-
"¥": 125.0,
|
|
127
|
-
"©": 126.0,
|
|
128
|
-
"®": 127.0,
|
|
129
|
-
"™": 128.0,
|
|
130
|
-
"§": 129.0,
|
|
131
|
-
"°": 130.0,
|
|
132
|
-
"¬": 131.0,
|
|
133
|
-
"¶": 132.0,
|
|
134
|
-
"…": 133.0,
|
|
135
|
-
"«": 134.0,
|
|
136
|
-
"»": 135.0,
|
|
137
|
-
"‹": 136.0,
|
|
138
|
-
"›": 137.0,
|
|
139
|
-
"“": 138.0,
|
|
140
|
-
"”": 139.0,
|
|
141
|
-
"‘": 140.0,
|
|
142
|
-
"’": 141.0,
|
|
143
|
-
"•": 142.0,
|
|
144
|
-
"·": 143.0,
|
|
145
|
-
"‐": 144.0,
|
|
146
|
-
"‑": 145.0,
|
|
147
|
-
"‒": 146.0,
|
|
148
|
-
"–": 147.0,
|
|
149
|
-
"—": 148.0
|
|
150
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|