Aller au contenu principal

Class: SimpleNodeParser

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

Implements

Constructors

constructor

new SimpleNodeParser(init?)

Parameters

NameType
init?Object
init.chunkOverlap?number
init.chunkSize?number
init.includeMetadata?boolean
init.includePrevNextRel?boolean
init.textSplitter?SentenceSplitter

Defined in

packages/core/src/NodeParser.ts:106

Properties

includeMetadata

includeMetadata: boolean

Whether to include metadata in the nodes.

Defined in

packages/core/src/NodeParser.ts:100


includePrevNextRel

includePrevNextRel: boolean

Whether to include previous and next relationships in the nodes.

Defined in

packages/core/src/NodeParser.ts:104


textSplitter

textSplitter: SentenceSplitter

The text splitter to use.

Defined in

packages/core/src/NodeParser.ts:96

Methods

getNodesFromDocuments

getNodesFromDocuments(documents): (TextNode<Metadata> | ImageDocument<any>)[]

Generate Node objects from documents

Parameters

NameType
documentsBaseNode<Metadata>[]

Returns

(TextNode<Metadata> | ImageDocument<any>)[]

Implementation of

NodeParser.getNodesFromDocuments

Defined in

packages/core/src/NodeParser.ts:137


fromDefaults

Static fromDefaults(init?): SimpleNodeParser

Parameters

NameType
init?Object
init.chunkOverlap?number
init.chunkSize?number
init.includeMetadata?boolean
init.includePrevNextRel?boolean

Returns

SimpleNodeParser

Defined in

packages/core/src/NodeParser.ts:124