Pular para o conteúdo principal

Class: KeywordExtractor

Extract keywords from a list of nodes.

Extends

Constructors

new KeywordExtractor()

new KeywordExtractor(options?): KeywordExtractor

Constructor for the KeywordExtractor class.

Parameters

options?: KeywordExtractArgs

Returns

KeywordExtractor

Overrides

BaseExtractor . constructor

Throws

If keywords is less than 1.

Source

packages/core/src/extractors/MetadataExtractors.ts:48

Properties

disableTemplateRewrite

disableTemplateRewrite: boolean = false

Inherited from

BaseExtractor . disableTemplateRewrite

Source

packages/core/src/extractors/types.ts:13


inPlace

inPlace: boolean = true

Inherited from

BaseExtractor . inPlace

Source

packages/core/src/extractors/types.ts:14


isTextNodeOnly

isTextNodeOnly: boolean = true

Inherited from

BaseExtractor . isTextNodeOnly

Source

packages/core/src/extractors/types.ts:10


keywords

keywords: number = 5

Number of keywords to extract.

Default

5

Source

packages/core/src/extractors/MetadataExtractors.ts:40


llm

llm: LLM<object, object>

LLM instance.

Source

packages/core/src/extractors/MetadataExtractors.ts:33


metadataMode

metadataMode: MetadataMode = MetadataMode.ALL

Inherited from

BaseExtractor . metadataMode

Source

packages/core/src/extractors/types.ts:12


numWorkers

numWorkers: number = 4

Inherited from

BaseExtractor . numWorkers

Source

packages/core/src/extractors/types.ts:15


showProgress

showProgress: boolean = true

Inherited from

BaseExtractor . showProgress

Source

packages/core/src/extractors/types.ts:11

Methods

extract()

extract(nodes): Promise<ExtractKeyword[] | object[]>

Parameters

nodes: BaseNode <Metadata>[]

Nodes to extract keywords from.

Returns

Promise<ExtractKeyword[] | object[]>

Keywords extracted from the nodes.

Overrides

BaseExtractor . extract

Source

packages/core/src/extractors/MetadataExtractors.ts:85


extractKeywordsFromNodes()

extractKeywordsFromNodes(node): Promise<object | ExtractKeyword>

Parameters

node: BaseNode <Metadata>

Node to extract keywords from.

Returns

Promise<object | ExtractKeyword>

Keywords extracted from the node.

Source

packages/core/src/extractors/MetadataExtractors.ts:63


processNodes()

processNodes(nodes, excludedEmbedMetadataKeys, excludedLlmMetadataKeys): Promise <BaseNode <Metadata>[]>

Parameters

nodes: BaseNode <Metadata>[]

Nodes to extract metadata from.

excludedEmbedMetadataKeys: undefined | string[]= undefined

Metadata keys to exclude from the embedding.

excludedLlmMetadataKeys: undefined | string[]= undefined

Metadata keys to exclude from the LLM.

Returns

Promise <BaseNode <Metadata>[]>

Metadata extracted from the nodes.

Inherited from

BaseExtractor . processNodes

Source

packages/core/src/extractors/types.ts:34


transform()

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

Parameters

nodes: BaseNode <Metadata>[]

options?: any

Returns

Promise <BaseNode <Metadata>[]>

Inherited from

BaseExtractor . transform

Source

packages/core/src/extractors/types.ts:19