mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-09 11:25:21 +03:00
2.0 KiB
2.0 KiB
In [3]:
# This is a long document we can split up.
with open('../../../state_of_the_union.txt') as f:
state_of_the_union = f.read()In [4]:
from langchain.text_splitter import TokenTextSplitterIn [5]:
text_splitter = TokenTextSplitter(chunk_size=10, chunk_overlap=0)In [6]:
texts = text_splitter.split_text(state_of_the_union)
print(texts[0])Madam Speaker, Madam Vice President, our
In [ ]: