Skip to main content
RecursiveCharacterTextSplitter includes prebuilt lists of separators that are useful for splitting text in a specific programming language. Supported languages are stored in the langchain_text_splitters.Language enum. They include:
To view the list of separators for a given language, pass a value from this enum into
To instantiate a splitter that is tailored for a specific language, pass a value from the enum into
Below we demonstrate examples for the various languages.
To view the full list of supported languages:
You can also see the separators used for a given language:

Python

Here’s an example using the PythonTextSplitter:

JS

Here’s an example using the JS text splitter:

TS

Here’s an example using the typescript text splitter:

Markdown

Here’s an example using the Markdown text splitter:

Latex

Here’s an example on Latex text:

HTML

Here’s an example using an HTML text splitter:

Solidity

Here’s an example using the Solidity text splitter:

C#

Here’s an example using the C# text splitter:

Haskell

Here’s an example using the Haskell text splitter:

PHP

Here’s an example using the PHP text splitter:

PowerShell

Here’s an example using the PowerShell text splitter:

Visual basic 6