Skip to content

NlpService

Defined in: service/service.ts:20

Resolves an NlpEngine over whatever providers a Services container has registered, and holds it for the life of that container.

The engine itself takes plain arrays so it can be tested in isolation; this is the adapter that fetches them from the registry. Setup is deferred to first use rather than done in the constructor because provider instances resolve asynchronously and Services constructs synchronously.

new NlpService(services): NlpService;

Defined in: service/service.ts:24

Parameter Type
services Services

NlpService

destroy: Promise<void>;

Defined in: service/service.ts:64

Promise<void>


classify(text, options?): Promise<NlpMatch | undefined>;

Defined in: service/service.ts:53

Matches text against every registered provider’s intents.

Parameter Type
text string
options NlpClassifyOptions

Promise<NlpMatch | undefined>


execute(options): Promise<void>;

Defined in: service/service.ts:59

Runs a match’s intent, exactly as NlpService.classify handed it back.

Parameter Type
options NlpExecuteOptions

Promise<void>


getEngine(): Promise<NlpEngine>;

Defined in: service/service.ts:45

The engine, trained. The first caller pays for training; everyone after shares it, including the callers that arrive while that first train is still running.

Promise<NlpEngine>