mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Put entry splitting regex in explicit filter into a variable for code readability
This commit is contained in:
parent
3aac3c7d52
commit
c3b3e8959d
1 changed files with 3 additions and 3 deletions
|
@ -15,11 +15,11 @@ def explicit_filter(raw_query, entries, embeddings):
|
|||
return query, entries, embeddings
|
||||
|
||||
# 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()
|
||||
for word
|
||||
in re.split(
|
||||
r',|\.| |\]|\[\(|\)|\{|\}|\t|\n|\:', # split on fullstop, comma or any brackets
|
||||
entry[1])
|
||||
in re.split(entry_splitter, entry[1])
|
||||
if word != "")
|
||||
for entry in entries]
|
||||
|
||||
|
|
Loading…
Reference in a new issue