The Chatbot API and SDK provide respectively an endpoint and a languageDetector method that makes it possible to detect the language of a user intent. If your Inbenta solution includes multiple Inbenta instances in different languages, this allows you to suggest which one of these instances appears to be the best suited to provide results to this intent. If you only have one instance, it obviously becomes the best and only option.
Inbenta's language detection can only search the languages associated with your instances. If you need more, you may need to use another language detection system from a third-party provider.
Several methods exist to detect the language of the user intent.
Language detection upon No Results
This is the solution recommended by Inbenta. It involves detecting the language only when the Chatbot is unable to find any results for the user intent.
The Chatbot follows these steps:
The following diagram explains this flow:
There are two ways to call the language detector after the Chatbot returns a No Results:
Continuous language detection
You can also evaluate the language of all incoming user intents and then decide to search for results or not, depending on the detected language.
Inbenta does not recommend using this option as it doubles the number of API requests: This impacts both the performance and the cost of your solution.
The following diagram explains this flow:
Using the right solution
There are two factors to consider when you decide to use one solution over the other:
Remember that f you use the first option, all user intents, including the ones in unexpected languages, are registered in the system as user inputs.
The solution that performs the lowest number of requests to the API, and thus is more cost effective, depends on the number of user intents that you receive that are in an unexpected language. This is why Inbenta typically recommends the first option: if you get very few of these questions, then the second option becomes very expensive for minimal gains. It only becomes cheaper if you regularly receive a third or more of your user questions in an unexpected language.
The Chatbot API automatically tracks language detection when it occurs. This is done with the log type and data key called LANGUAGE_DETECTION. For more information, see API Tracking Guidelines.
The Chatbot App's Sessions > Details show when a language was detected in the conversation transcript. How exactly it appears in Sessions > Details may vary depending on your integration method.
These are Inbenta's suggestions for the best way to detect the user intent language, but other solutions are possible.