Replace word_count with maximum_length in if clause
This commit is contained in:
parent
9b2fb09c59
commit
9ea2634480
1 changed files with 1 additions and 1 deletions
|
|
@ -15,7 +15,7 @@ def chunk_by_sentence(data: str, maximum_length: Optional[int] = None):
|
|||
sentence += word
|
||||
word_count += 1
|
||||
|
||||
if word_type == "paragraph_end" or word_type == "sentence_end" or ((word_count is not None) and (word_count == maximum_length)):
|
||||
if word_type == "paragraph_end" or word_type == "sentence_end" or ((maximum_length is not None) and (word_count == maximum_length)):
|
||||
yield (paragraph_id, chunk_index, sentence, word_count, word_type)
|
||||
sentence = ""
|
||||
word_count = 0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue