TreeSitterSegmenter#

class langchain_community.document_loaders.parsers.language.tree_sitter_segmenter.TreeSitterSegmenter(code: str)[source]#

Abstract class for `CodeSegmenter`s that use the tree-sitter library.

Methods

Parameters:

code (str) –

__init__(code: str)[source]#
Parameters:

code (str) –

extract_functions_classes() List[str][source]#
Return type:

List[str]

abstract get_chunk_query() str[source]#
Return type:

str

abstract get_language() Language[source]#
Return type:

Language

get_parser() Parser[source]#
Return type:

Parser

is_valid() bool[source]#
Return type:

bool

abstract make_line_comment(text: str) str[source]#
Parameters:

text (str) –

Return type:

str

simplify_code() str[source]#
Return type:

str