Class: KeywordExtractor
Extract keywords from a list of nodes.
Hierarchy
-
↳
KeywordExtractor
Constructors
constructor
• new KeywordExtractor(options?
): KeywordExtractor
Constructor for the KeywordExtractor class.
Parameters
Name | Type |
---|---|
options? | KeywordExtractArgs |
Returns
Throws
If keywords is less than 1.
Overrides
Defined in
packages/core/src/extractors/MetadataExtractors.ts:48
Properties
disableTemplateRewrite
• disableTemplateRewrite: boolean
= false
Inherited from
BaseExtractor.disableTemplateRewrite
Defined in
packages/core/src/extractors/types.ts:13
inPlace
• inPlace: boolean
= true
Inherited from
Defined in
packages/core/src/extractors/types.ts:14
isTextNodeOnly
• isTextNodeOnly: boolean
= true
Inherited from
Defined in
packages/core/src/extractors/types.ts:10
keywords
• keywords: number
= 5
Number of keywords to extract.
Default
5
Defined in
packages/core/src/extractors/MetadataExtractors.ts:40
llm
• llm: LLM
<Record
<string
, unknown
>, Record
<string
, unknown
>>
LLM instance.
Defined in
packages/core/src/extractors/MetadataExtractors.ts:33
metadataMode
• metadataMode: MetadataMode
= MetadataMode.ALL
Inherited from
Defined in
packages/core/src/extractors/types.ts:12
numWorkers
• numWorkers: number
= 4
Inherited from
Defined in
packages/core/src/extractors/types.ts:15
showProgress
• showProgress: boolean
= true
Inherited from
Defined in
packages/core/src/extractors/types.ts:11
Methods
extract
▸ extract(nodes
): Promise
<ExtractKeyword
[] | {}[]>
Parameters
Name | Type | Description |
---|---|---|
nodes | BaseNode <Metadata >[] | Nodes to extract keywords from. |
Returns
Promise
<ExtractKeyword
[] | {}[]>
Keywords extracted from the nodes.
Overrides
Defined in
packages/core/src/extractors/MetadataExtractors.ts:85
extractKeywordsFromNodes
▸ extractKeywordsFromNodes(node
): Promise
<{} | ExtractKeyword
>
Parameters
Name | Type | Description |
---|---|---|
node | BaseNode <Metadata > | Node to extract keywords from. |
Returns
Promise
<{} | ExtractKeyword
>
Keywords extracted from the node.
Defined in
packages/core/src/extractors/MetadataExtractors.ts:63
processNodes
▸ processNodes(nodes
, excludedEmbedMetadataKeys?
, excludedLlmMetadataKeys?
): Promise
<BaseNode
<Metadata
>[]>
Parameters
Name | Type | Default value | Description |
---|---|---|---|
nodes | BaseNode <Metadata >[] | undefined | 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
Metadata extracted from the nodes.
Inherited from
Defined in
packages/core/src/extractors/types.ts:34
transform
▸ transform(nodes
, options?
): Promise
<BaseNode
<Metadata
>[]>
Parameters
Name | Type |
---|---|
nodes | BaseNode <Metadata >[] |
options? | any |