```python
# This is a long document we can split up.
with open('../../../state_of_the_union.txt') as f:
    state_of_the_union = f.read()
```


```python
from langchain.text_splitter import RecursiveCharacterTextSplitter
```


```python
text_splitter = RecursiveCharacterTextSplitter(
    # Set a really small chunk size, just to show.
    chunk_size = 100,
    chunk_overlap  = 20,
    length_function = len,
    is_separator_regex = False,
)
```


```python
texts = text_splitter.create_documents([state_of_the_union])
print(texts[0])
print(texts[1])
```

<CodeOutputBlock lang="python">

```
    page_content='Madam Speaker, Madam Vice President, our First Lady and Second Gentleman. Members of Congress and' lookup_str='' metadata={} lookup_index=0
    page_content='of Congress and the Cabinet. Justices of the Supreme Court. My fellow Americans.' lookup_str='' metadata={} lookup_index=0
```

</CodeOutputBlock>


```python
text_splitter.split_text(state_of_the_union)[:2]
```

<CodeOutputBlock lang="python">

```
    ['Madam Speaker, Madam Vice President, our First Lady and Second Gentleman. Members of Congress and',
     'of Congress and the Cabinet. Justices of the Supreme Court. My fellow Americans.']
```

</CodeOutputBlock>
