Skip to main content

Class: SimpleNodeParser

SimpleNodeParser is the default NodeParser. It splits documents into TextNodes using a splitter, by default SentenceSplitter

Implements

Constructors

new SimpleNodeParser()

new SimpleNodeParser(init?): SimpleNodeParser

Parameters

init?

init.chunkOverlap?: number

init.chunkSize?: number

init.includeMetadata?: boolean

init.includePrevNextRel?: boolean

init.splitLongSentences?: boolean

init.textSplitter?: SentenceSplitter

Returns

SimpleNodeParser

Source

packages/core/src/nodeParsers/SimpleNodeParser.ts:24

Properties

includeMetadata

includeMetadata: boolean

Whether to include metadata in the nodes.

Source

packages/core/src/nodeParsers/SimpleNodeParser.ts:18


includePrevNextRel

includePrevNextRel: boolean

Whether to include previous and next relationships in the nodes.

Source

packages/core/src/nodeParsers/SimpleNodeParser.ts:22


textSplitter

textSplitter: SentenceSplitter

The text splitter to use.

Source

packages/core/src/nodeParsers/SimpleNodeParser.ts:14

Methods

getNodesFromDocuments()

getNodesFromDocuments(documents): TextNode <Metadata>[]

Generate Node objects from documents

Parameters

documents: BaseNode <Metadata>[]

Returns

TextNode <Metadata>[]

Implementation of

NodeParser . getNodesFromDocuments

Source

packages/core/src/nodeParsers/SimpleNodeParser.ts:60


transform()

transform(nodes, _options?): Promise <BaseNode <Metadata>[]>

Parameters

nodes: BaseNode <Metadata>[]

_options?: any

Returns

Promise <BaseNode <Metadata>[]>

Implementation of

NodeParser . transform

Source

packages/core/src/nodeParsers/SimpleNodeParser.ts:43


fromDefaults()

static fromDefaults(init?): SimpleNodeParser

Parameters

init?

init.chunkOverlap?: number

init.chunkSize?: number

init.includeMetadata?: boolean

init.includePrevNextRel?: boolean

Returns

SimpleNodeParser

Source

packages/core/src/nodeParsers/SimpleNodeParser.ts:47