I am working on a project and I need to build a chatbot that will be used in three different countries, Greece, Italy, Romania. I have seen the N26 video and I have also read some articles like this.
I get these approaches to be different ways (if not please correct me) to develop a multilingual chatbot. But which one is better? What do you suggest? Is there any other tutorial to have a look at?
Hey @ChrisRahme , I went through all these. Really helpful. I appreciate your help.
I will follow your approach in this case. I have a question related to this. If users use the agent via an Android app, do you know if it is possible to letâs say the user defines once his preferred language and the app to send this choice to the agent every time the user logs in?
Well, this is something I donât know for sure but I assume that each user will talk only in one language. Your approach follows the first bullet from the above, correct?
One last question, in your domain file you have implemented some responses to any language and others (like faq) only in one, what is the purpose of this? My understanding is that I have to implement every response to every language I will use.
In my country, people usually mix up 3 languages when they talk, even in a same sentence. So my approach was to first ask the user which language they want, then only reply in this language (until user asks to change it again).
But the user will still be able to understand all languages. If you take a look at some of my botâs NLU data, you can see 5 languages in a same intent, sometimes all mixed up in one example.
Most responses come from the custom actions, which dispatches the message according the language slot (this can now be done without custom actions via conditional response variations).
But, basically, not all responses are implemented because the bot is unfinished This bot was just a proof-of-concept for a bot that is privatized by a company.
Hey @ChrisRahme , I am coming back to this because for some reason the tracker seems to have stopped identifying the language entity on the very first userâs message but works fine with the buttons. The thing is that two days ago it worked just fine.
I have followed your chatbotâs implementation.
class ActionUtterGreet(Action):
def name(self):
return "action_utter_greet"
def run(self, dispatcher, tracker, domain):
announce(self, tracker)
followup_action = "action_utter_ask_mood"
text = get_text_from_lang(
tracker,
[
"Hey there! I am your Alameda personal assistant powered by artificial intelligence.",
"ÎΔÎčÎŹ, Î”ÎŻÎŒÎ±Îč Îż ÏÏÎżÏÏÏÎčÎșÏÏ ÎČοηΞÏÏ ÏÎżÏ Alameda."
]
)
if tracker.get_slot("language") is None or not tracker.get_slot("language"):
followup_action = "action_utter_ask_language"
print("\nBOT:", text)
dispatcher.utter_message(text=text)
return [FollowupAction(followup_action)]
It dispatches correctly the text from this function e.g. Hey there! I am your Alameda personal assistant powered by artificial intelligence. but when it comes here
if tracker.get_slot("language") is None or not tracker.get_slot("language"):
followup_action = "action_utter_ask_language"
So itâs probably the case that the language wasnât even set before (get_text_from_lang() defaults to the first entry in the list if no language was detected).
Anyway, youâre saying the entity is detected when entered via buttons, but not via text?
set_language is for when the user asks to set the language, which should run action_set_language.
greet will run action_greet, which will greet the user back and then run action_ask_languageif the language slot is not already set.
action_ask_language will ask the user to choose a language. Logically, the user will answer with the set_language intent, which should run action_set_language.
I thought that when the user greets in greek the agent is able to understand it and based on that to choose the corresponded answer from the custom action.
But, now I think this is not the case and the language should be set at the very beginning either the user asks for it or in the case of an app somehow the agent get informed to use a specific language, is that correct?
You went with approach #1 from that thread. If you want language detection you should go woth #2 and create a custom pipeline component that detects the language and sets the language slot on each message.
get_text_from_lang() is just a function that returns the correct output of the given list according to the language slot
You can keep it or do a bunch of if language == '...'. But anyway, you donât need custom actions for that anymore, you can use Conditional Response Variations instead:
responses:
utter_greet:
- condition:
- type: slot
name: language
value: greek
text: "ÎΔÎčÎŹ, Î”ÎŻÎŒÎ±Îč Îż ÏÏÎżÏÏÏÎčÎșÏÏ ÎČοηΞÏÏ ÏÎżÏ Alameda."
- text: "Hey there! I am your Alameda personal assistant powered by artificial intelligence."