export default class Bot { constructor(opt: any); entities: any; data: any[]; dataByUtter: any; steps: any[]; history: {}; /** * Pre process data * @param {Array} data * @returns normalized and implicit/derived data */ getData(data: any[]): any[]; /** * Pre process entities * @param {Object} entities entities * @returns entities */ getEntities(entities: any): any; /** * Create all derived utterance * > if utterance contains an entity, replace it by its spellings * > if utterance contains regex, replace it by its name * @param {String} utter utterance * @returns derived utterance */ getAllDerivedUtters(utter: string): { text: string; models: any[]; }[]; /** * Process utterance and get answer * @param {String} text utterance * @returns {String} answer */ process(text: string): string; /** * Get context for answers * @param {Object} o base object * @returns {Object} context */ getContext(o?: any): any; /** * Keep a ref to context for each intent * @param {Object} context */ pushToHistory({ answers, history, intent, models, steps, ...data }: any): void; /** * Normalize a text * @param {String} text * @returns normalized text */ normalize(text: string): string; /** * Compare utterances and find the best match * @param {String} text utterance * @param {Array} utterances utterances recorded in the chatbot * @param {Number} min minimum levenshtein distance * @returns {Object} match info */ bestMatch(text: string, utterances: any[], min?: number): any; /** * Find models/entities in utterance * @param {String} txt utterance * @param {Array} models list of models to find * @returns {Array} list of models found */ extractModels(txt: string, models: any[]): any[]; /** * Check and correct the order of the models found * @param {Array} extracted list of models found * @param {Array} models list of models to find * @returns {Array} ordered list */ correctExtracted(extracted: any[], models: any[]): any[]; /** * Find first matching model * @param {Object} model * @param {String} model.entity * @param {String} model.type * @param {Array} extracted list of models found * @returns {Object} model found */ findBestModel({ entity, type }: { entity: string; type: string; }, extracted: any[]): any; }