diff --git a/apps/web-crawl-q-and-a/web-qa.py b/apps/web-crawl-q-and-a/web-qa.py index 4a2224a3..a5a86dd5 100644 --- a/apps/web-crawl-q-and-a/web-qa.py +++ b/apps/web-crawl-q-and-a/web-qa.py @@ -248,6 +248,10 @@ def split_into_many(text, max_tokens = max_tokens): # Otherwise, add the sentence to the chunk and add the number of tokens to the total chunk.append(sentence) tokens_so_far += token + 1 + + # Add the last chunk to the list of chunks + if chunk: + chunks.append(". ".join(chunk) + ".") return chunks