UNPKG

classifier.js

Version:

:robot: Natural language processing with Javascript

23 lines (22 loc) 928 B
import { ClassifierProps, ClassifierOptions, Dataset } from './types'; export declare class Classifier { private categories; options: ClassifierOptions; constructor(options?: ClassifierOptions); calculateAccuracy(trainData: Dataset, validationData: Dataset): string | number; learn(sentence: string, inputs: string | string[]): void; private normalizeData; private getUnknownScore; classify(sentence: string): string | Record<string, string | number>; private extractBestMatch; private getTokens; resetKnowledge(): void; private ensureAttributesForCreation; getModel(): ClassifierProps; toYAML(filepath: string): Promise<void>; toJSON(filepath: string): Promise<void>; fromYAML(filePath: string, options?: ClassifierOptions): Promise<void>; fromJSON(filePath: string, options?: ClassifierOptions): Promise<void>; private freeMemory; private analize; }