.rst
.pdf
Text Splitter
Text Splitter#
Functionality for splitting text.
class langchain.text_splitter.CharacterTextSplitter(separator: str = '\n\n', **kwargs: Any)[source]#
Implementation of splitting text that looks at characters.
split_text(text: str) → List[str][source]#
Split incoming text and return chunks.
class langchain.text_splitter.HeaderType[source]#
data: str#
level: int#
name: str#
class langchain.text_splitter.Language(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
CPP = 'cpp'#
GO = 'go'#
HTML = 'html'#
JAVA = 'java'#
JS = 'js'#
LATEX = 'latex'#
MARKDOWN = 'markdown'#
PHP = 'php'#
PROTO = 'proto'#
PYTHON = 'python'#
RST = 'rst'#
RUBY = 'ruby'#
RUST = 'rust'#
SCALA = 'scala'#
SOL = 'sol'#
SWIFT = 'swift'#
class langchain.text_splitter.LatexTextSplitter(**kwargs: Any)[source]#
Attempts to split the text along Latex-formatted layout elements.
class langchain.text_splitter.LineType[source]#
content: str#
metadata: Dict[str, str]#
class langchain.text_splitter.MarkdownHeaderTextSplitter(headers_to_split_on: List[Tuple[str, str]], return_each_line: bool = False)[source]#
Implementation of splitting markdown files based on specified headers.
aggregate_lines_to_chunks(lines: List[langchain.text_splitter.LineType]) → List[langchain.text_splitter.LineType][source]#
Combine lines with common metadata into chunks
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/text_splitter.html