alan-ai/alan-sdk-ionic

Is it possible to change required score to match intent

ljudbane opened this issue · 2 comments

Is it possible to adjust at what score the intent is matched?

We have observed cases where there are multiple intents available and user says something completely different and it will get matched to some intent with a low score (ex. 0.6).

Another example, we have a situation in the scripts where we lock the user into a yes/no context (with fallback). At this point we expect a clear yes or no from the user and everything else should trigger fallback message. During testing we observed that saying random words/sentences will sometimes get matched to yes/no with low score. Could we set a score threshold for specific intents?

Hello, at the moment this feature is not available but it's a work in progress.

Still, there are some tricks that might help with your issues:

  1. For cases where some intents are matched with the low score - try adding more alternative patterns to each such intent. This should help and increase the accuracy.
  2. When you need a pattern or some specific word to be matched only when user input is 100% similar - you can use slots. So if you want intent to match only to "yes" or "no" - use pattern "$(REACTION yes|no)".
intent("$(REACTION yes|no)", p => {
    p.play(`Your answer is ${p.REACTION.value}`);
});

@aermilin Thank you for the hints, we will try to incorporate them in our Alan scripts.