Skip to content
Closed
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
5 changes: 2 additions & 3 deletions python/infinity_sdk/infinity/rag_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,8 @@ def _split_by_lang(self, line):
s = e
e = s + 1
zh = _zh
if s >= len(a):
continue
txt_lang_pairs.append((a[s:e], zh))
Copy link

@KevinHuSh KevinHuSh Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciations!
I can't see any side effects If e exceeds the length of a.
a[s:min(e, len(a))] equals to a[s:e].

if s < len(a): # Changed from s >= len(a) to be clearer
txt_lang_pairs.append((a[s:min(e, len(a))], zh)) # Ensure e doesn't exceed length of a
return txt_lang_pairs

def tokenize(self, line: str) -> str:
Expand Down