Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion autorag/autorag/nodes/retrieval/bm25.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ def tokenize_ko_kiwi(texts: List[str]) -> List[List[str]]:
texts = list(map(lambda x: x.strip().lower(), texts))
kiwi = Kiwi()
tokenized_list: Iterable[List[Token]] = kiwi.tokenize(texts)
return [list(map(lambda x: x.form, token_list)) for token_list in tokenized_list]

def extract_form_safe(x):
try:
return x.form
except UnicodeDecodeError:
return " "

return [
list(map(lambda x: extract_form_safe(x), token_list))
for token_list in tokenized_list
]


def tokenize_ko_kkma(texts: List[str]) -> List[List[str]]:
Expand Down
Loading