mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 21:29:13 +00:00
Put entry splitting regex in explicit filter into a variable for code readability
This commit is contained in:
@@ -15,11 +15,11 @@ def explicit_filter(raw_query, entries, embeddings):
|
|||||||
return query, entries, embeddings
|
return query, entries, embeddings
|
||||||
|
|
||||||
# convert each entry to a set of words
|
# convert each entry to a set of words
|
||||||
|
# split on fullstop, comma, colon, tab, newline or any brackets
|
||||||
|
entry_splitter = r',|\.| |\]|\[\(|\)|\{|\}|\t|\n|\:'
|
||||||
entries_by_word_set = [set(word.lower()
|
entries_by_word_set = [set(word.lower()
|
||||||
for word
|
for word
|
||||||
in re.split(
|
in re.split(entry_splitter, entry[1])
|
||||||
r',|\.| |\]|\[\(|\)|\{|\}|\t|\n|\:', # split on fullstop, comma or any brackets
|
|
||||||
entry[1])
|
|
||||||
if word != "")
|
if word != "")
|
||||||
for entry in entries]
|
for entry in entries]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user