interface NlpListener
(source)
Used to customize behaviour of NLP parsing - and also to monitor NLP requests - on bot side. Has to be registered using ai.tock.bot.engine.BotRepository.registerNlpListener.
error |
Called when nlp request is throwing an error. open fun error(query: NlpQuery, dialog: Dialog, throwable: Throwable?): Unit |
evaluateEntities |
Allows custom entity evaluation - default returns empty list. open fun evaluateEntities(userTimeline: UserTimeline, dialog: Dialog, event: Event, nlpResult: NlpResult): List<EntityValue> |
findIntent |
This method is automatically called by the bot after a NLP request in order to select an intent. Overrides it if you need more control on intent choice. open fun findIntent(userTimeline: UserTimeline, dialog: Dialog, event: Event, nlpResult: NlpResult): IntentAware? |
handleKeyword |
Used to handle "secret" keywords. open fun handleKeyword(sentence: String): Intent? |
mergeEntityValues |
Allows to override NlpEntityMergeContext before trying to merge the entity context. open fun mergeEntityValues(dialogState: DialogState, action: Action, entityToMerge: NlpEntityMergeContext): NlpEntityMergeContext |
sortEntitiesToMerge |
Defines custom sort new entity values. This is useful when you want to evaluate an entity role only after an other entity role has been evaluated (entity dependence use case). Default does nothing. open fun sortEntitiesToMerge(entities: List<NlpEntityMergeContext>): List<NlpEntityMergeContext> |
success |
Called when nlp request is successful. open fun success(query: NlpQuery, result: NlpResult): Unit |
BuiltInKeywordListener |
Built-in listener to start BotDefinition.keywordStory. object BuiltInKeywordListener : NlpListener |