Hey,

I am trying to set language for alice bot as Dutch but it is always picking up english as default language.

Code:

 

speech = Runtime.createAndStart("Speech","AcapelaSpeech")

lloyd = Runtime.createAndStart("lloyd", "ProgramAB")

lloyd.startSession("kevin", "alice2")

webgui = Runtime.create("WebGui","WebGui")

webgui.autoStartBrowser(True)

webgui.startService()

wksr = Runtime.createAndStart("webkitspeechrecognition", "WebkitSpeechRecognition")

htmlfilter = Runtime.createAndStart("htmlfilter", "HtmlFilter")

speech.speak("Testing to speak")

wksr.addTextListener(lloyd)

lloyd.addTextListener(htmlfilter)

htmlfilter.addTextListener(speech)

speech.setLanguage("nl")

wksr.setLanguage("nl-NL")

speech.speak("#LAUGH02#")

speech.speak("Hallo schatje")

wksr.addListener("publishText","python","heard")

def heard(data):

print "heard", data

juerg

7 years 9 months ago

you start your bot with "kevin","alice2". this loads aiml files from ..bots/alice2 folder. clean out that folder and create a new nl.aiml file in there with correct aiml header. add a new category with pattern * and an nl template for it.

you might need to set the voice too for one able to pronounce nl, speech.setVoice("<nl voice>")

now reload your bot (swing gui, tab alice2, check correct path, user, botname, start/reload session) and enter any question.

respond should now be for all entries your * template text.

I recommend to start with small additions to this basic function. separate new commands in there own aiml files so you do not break working patterns. All (correct) aiml files in the bots folder get combined automagically

thanks juerg !

I will start working on it !

Also, Can you help me to check what the bot intends to answer, so  I can manually prevent it from executing the response, and instead manually override the response with the free text input field?

not sure i understand exactly what you mean with override.

the top text field in the bot's tab can be used instead of the mic (or rather the webkitspeechrecognition result of what you spoke into the mic)

the text is then sent to the programAB where the matching with the existing patterns happens. if your template contains text you will see the response in the large window (and also hear if speech is set up correctly)

as things are currently set you can not intercept an action triggered by a matching pattern. wksr is however magically good so chances you trigger unwanted actions are small.

if you still do not like immediate actions look into topics. with an initial pattern e.g. test you can set the topic to test. once done create patterns within this topic range (including the all catching * pattern) so you won't accidentally trigger other actions in other parts of the loaded aiml files.