Skip to content

Commit

Permalink
Add chunk test
Browse files Browse the repository at this point in the history
  • Loading branch information
jncraton committed Apr 21, 2024
1 parent 9fc78cf commit 41c66fa
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion languagemodels/embeddings.py
Expand Up @@ -100,7 +100,7 @@ def chunk_doc(doc, name="", chunk_size=64, chunk_overlap=8):
>>> chunk_doc("")
[]
>>> chunk_doc(""
>>> chunk_doc(
... "It was the best of times, it was the worst of times, it was the age "
... "of wisdom, it was the age of foolishness, it was the epoch of belief, "
... "it was the epoch of incredulity, it was the season of Light, it was "
Expand All @@ -112,6 +112,16 @@ def chunk_doc(doc, name="", chunk_size=64, chunk_overlap=8):
... "good or for evil, in the superlative degree of comparison only.")
['It was the best of times...']
>>> chunk_doc(
... "One morning, when Gregor Samsa woke from troubled dreams, he found "
... "himself transformed in his bed into a horrible vermin. He lay on his "
... "armour-like back, and if he lifted his head a little he could see "
... "his brown belly, slightly domed and divided by arches into stiff "
... "sections. The bedding was hardly able to cover it and seemed ready "
... "to slide off any moment. His many legs, pitifully thin compared with "
... "the size of the rest of him, waved about helplessly as he looked.")
['One morning, ...']
>>> chunk_doc("Hello")
['Hello']
Expand Down

0 comments on commit 41c66fa

Please sign in to comment.