base90-rag 0.2.2__tar.gz → 0.2.3__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.
- {base90_rag-0.2.2 → base90_rag-0.2.3}/PKG-INFO +1 -1
- {base90_rag-0.2.2 → base90_rag-0.2.3}/base90_rag/core.py +32 -21
- {base90_rag-0.2.2 → base90_rag-0.2.3}/base90_rag.egg-info/PKG-INFO +1 -1
- {base90_rag-0.2.2 → base90_rag-0.2.3}/pyproject.toml +1 -1
- {base90_rag-0.2.2 → base90_rag-0.2.3}/LICENSE +0 -0
- {base90_rag-0.2.2 → base90_rag-0.2.3}/README.md +0 -0
- {base90_rag-0.2.2 → base90_rag-0.2.3}/base90_rag/__init__.py +0 -0
- {base90_rag-0.2.2 → base90_rag-0.2.3}/base90_rag/default_dict.json +0 -0
- {base90_rag-0.2.2 → base90_rag-0.2.3}/base90_rag.egg-info/SOURCES.txt +0 -0
- {base90_rag-0.2.2 → base90_rag-0.2.3}/base90_rag.egg-info/dependency_links.txt +0 -0
- {base90_rag-0.2.2 → base90_rag-0.2.3}/base90_rag.egg-info/top_level.txt +0 -0
- {base90_rag-0.2.2 → base90_rag-0.2.3}/setup.cfg +0 -0
|
@@ -204,47 +204,58 @@ class Base90Memory:
|
|
|
204
204
|
valid_sets = []
|
|
205
205
|
for code in query_codes:
|
|
206
206
|
if code in self.mem_inverted:
|
|
207
|
-
|
|
208
|
-
if len(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
valid_sets.append(
|
|
207
|
+
inv_set = self.mem_inverted[code]
|
|
208
|
+
if len(inv_set) > 5000:
|
|
209
|
+
from itertools import islice
|
|
210
|
+
inv_set = set(islice(inv_set, 5000))
|
|
211
|
+
valid_sets.append(inv_set)
|
|
212
212
|
|
|
213
213
|
if not valid_sets: return []
|
|
214
214
|
|
|
215
215
|
valid_sets.sort(key=len)
|
|
216
|
-
|
|
217
216
|
candidate_pids = valid_sets[0].copy()
|
|
218
217
|
for i in range(1, len(valid_sets)):
|
|
219
218
|
candidate_pids = candidate_pids.intersection(valid_sets[i])
|
|
220
219
|
if not candidate_pids:
|
|
221
220
|
break
|
|
222
221
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
candidate_pids = set(islice(candidate_pids, 2000))
|
|
222
|
+
import re
|
|
223
|
+
clean_query = re.sub(r'\s+', '', query).lower()
|
|
226
224
|
|
|
227
225
|
final_results = []
|
|
228
226
|
|
|
227
|
+
def _is_match(raw_text):
|
|
228
|
+
if query in raw_text:
|
|
229
|
+
return True
|
|
230
|
+
|
|
231
|
+
if clean_query in raw_text.replace(" ", "").lower():
|
|
232
|
+
return True
|
|
233
|
+
return False
|
|
234
|
+
|
|
229
235
|
if candidate_pids:
|
|
236
|
+
check_count = 0
|
|
230
237
|
for pid in candidate_pids:
|
|
231
238
|
v = self.mem_vaults.get(pid)
|
|
232
|
-
if v and
|
|
239
|
+
if v and _is_match(v["text"]):
|
|
233
240
|
final_results.append(v["text"])
|
|
234
241
|
if len(final_results) >= limit:
|
|
235
242
|
return final_results
|
|
243
|
+
check_count += 1
|
|
244
|
+
if check_count > 2000:
|
|
245
|
+
break
|
|
236
246
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
if
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
247
|
+
if len(final_results) < limit:
|
|
248
|
+
check_count = 0
|
|
249
|
+
for pid in valid_sets[0]:
|
|
250
|
+
v = self.mem_vaults.get(pid)
|
|
251
|
+
if v and v["text"] not in final_results:
|
|
252
|
+
if _is_match(v["text"]):
|
|
253
|
+
final_results.append(v["text"])
|
|
254
|
+
if len(final_results) >= limit:
|
|
255
|
+
break
|
|
256
|
+
check_count += 1
|
|
257
|
+
if check_count > 300:
|
|
258
|
+
break
|
|
248
259
|
|
|
249
260
|
return final_results
|
|
250
261
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|