Skip to main content

Class: CodeSplitter()

Extends

CodeSplitter<Options>(nodes, options?): BaseNode<Metadata>[]

Type Parameters

Options extends Record<string, unknown>

Parameters

nodes: BaseNode<Metadata>[]

options?: Options

Returns

BaseNode<Metadata>[]

Defined in

packages/node-parser/code/dist/index.d.ts:11

Constructors

new CodeSplitter()

new CodeSplitter(params): CodeSplitter

Parameters

params: CodeSplitterParam

Returns

CodeSplitter

Overrides

TextSplitter.constructor

Defined in

packages/node-parser/code/dist/index.d.ts:14

Properties

id

id: string

Inherited from

TextSplitter.id

Defined in

packages/core/schema/dist/index.d.ts:172


includeMetadata

includeMetadata: boolean

Inherited from

TextSplitter.includeMetadata

Defined in

packages/core/node-parser/dist/index.d.ts:6


includePrevNextRel

includePrevNextRel: boolean

Inherited from

TextSplitter.includePrevNextRel

Defined in

packages/core/node-parser/dist/index.d.ts:7


maxChars

maxChars: number

Defined in

packages/node-parser/code/dist/index.d.ts:13

Methods

getNodesFromDocuments()

getNodesFromDocuments(documents): TextNode<Metadata>[]

Parameters

documents: TextNode<Metadata>[]

Returns

TextNode<Metadata>[]

Inherited from

TextSplitter.getNodesFromDocuments

Defined in

packages/core/node-parser/dist/index.d.ts:11


parseNodes()

protected parseNodes(nodes): TextNode<Metadata>[]

Parameters

nodes: TextNode<Metadata>[]

Returns

TextNode<Metadata>[]

Inherited from

TextSplitter.parseNodes

Defined in

packages/core/node-parser/dist/index.d.ts:16


postProcessParsedNodes()

protected postProcessParsedNodes(nodes, parentDocMap): TextNode<Metadata>[]

Parameters

nodes: TextNode<Metadata>[]

parentDocMap: Map<string, TextNode<Metadata>>

Returns

TextNode<Metadata>[]

Inherited from

TextSplitter.postProcessParsedNodes

Defined in

packages/core/node-parser/dist/index.d.ts:9


splitText()

splitText(text): string[]

Parameters

text: string

Returns

string[]

Overrides

TextSplitter.splitText

Defined in

packages/node-parser/code/dist/index.d.ts:15


splitTexts()

splitTexts(texts): string[]

Parameters

texts: string[]

Returns

string[]

Inherited from

TextSplitter.splitTexts

Defined in

packages/core/node-parser/dist/index.d.ts:15