NluService
nlu.NluService
Service for standalone using and testing NLU. Provides the API for training custom datasets, using pretrained skills and performing recognition requests.
Properties
skillInfo
• Readonly
skillInfo: Record<string, SkillInformation>= {}
Mapping of skill names to information about skills used for recognition
Accessors
isClosed
• get isClosed(): boolean
Check if nlu service is closed
Returns: boolean
true if service is closed, false otherwise
Methods
close
▸ close(): void
Close nlu service if it is alive
Returns: void
loadSkills
▸ loadSkills(skills
: SkillInformation[]): Promise<void>
Check if provided skills are available and use them in further recognitions
Parameters:
Name | Type |
---|---|
skills | SkillInformation[] |
Returns: Promise<void>
recognize
▸ recognize(text
: string): Promise<RecognitionResult>
Process text in nlu service and return recognition result
Parameters:
Name | Type | Description |
---|---|---|
text | string | Text to be recognized |
Returns: Promise<RecognitionResult>
recognition result
train
▸ train(nluDatasetPath
: string, language
: string): Promise<string>
Train provided nlu dataset
Parameters:
Name | Type | Description |
---|---|---|
nluDatasetPath | string | Path to nlu dataset |
language | string | BCP 47 language tag denoting language of dataset (e. g. "en-US"). @see https://en.wikipedia.org/wiki/IETF_language_tag |
Returns: Promise<string>
id of trained skill
▸ train(nluContent
: NluContent, language
: string): Promise<string>
Train provided nlu dataset
Parameters:
Name | Type | Description |
---|---|---|
nluContent | NluContent | Content of nlu dataset |
language | string | BCP 47 language tag denoting language of dataset (e. g. "en-US"). @see https://en.wikipedia.org/wiki/IETF_language_tag |
Returns: Promise<string>
id of trained skill
create
▸ Static
create(nluContent?
: NluContent, language?
: string, options?
: NluOptions): Promise<NluService>
Create instance of NLU service Optionally train dataset @param nluContent with language @param language if provided
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
nluContent? | NluContent | - | Intents file content |
language? | string | - | BCP 47 language tag denoting language of dataset (e. g. "en-US"). @see https://en.wikipedia.org/wiki/IETF_language_tag |
options | NluOptions | {} | Launch options |
Returns: Promise<NluService>