c# - AIML Bot Encoding Issue - Cyrillic Recognition Failure -
problem overview
since i've had task create chattering bot i've used aiml library perform simple conversation between user , computer. had configuration files , 1 aiml file called 'bank'. worked extremely well, while querying on english. main purpose make bot speak russian. so, moment i've been facing encoding problem. practically when type in cyrillic format, programm returs null output. tried change xml encoding utf-8, alter console encoding, decompile dll library seeking clue of problem. unfortunately nothing works.
code
bot class:
class acutus { private bot bot; private user user; public acutus() { bot = new bot(); user = new user("userid", bot); } public void initialize() { bot.loadsettings(); bot.isacceptinguserinput = false; bot.loadaimlfromfiles(); bot.isacceptinguserinput = true; } public string getoutput(string input) { request r = new request(input, user, bot); result result = bot.chat(r); return result.output; } }
main.cs:
bool issimulating = true; acutus acutus = new acutus(); acutus.initialize(); while (issimulating) { string input = console.readline(); issimulating = input == string.empty ? false : true; string output = acutus.getoutput(input); console.writeline(output); }
settings.xmls
<?xml version="1.0" encoding="utf-8" ?> <root> <item name="aimldirectory" value="aiml"/> <item name="configdirectory" value="config"/> <item name="logdirectory" value="logs"/> <item name="splittersfile" value="splitters.xml"/> <item name="maxlogbuffersize" value="64"/> <item name="person2substitutionsfile" value="person2substitutions.xml"/> <item name="personsubstitutionsfile" value="personsubstitutions.xml"/> <item name="gendersubstitutionsfile" value="gendersubstitutions.xml"/> <item name="defaultpredicates" value="defaultpredicates.xml"/> <item name="substitutionsfile" value="substitutions.xml"/> <item name="notacceptinguserinputmessage" value="this bot set not accept user input."/> <item name="stripperregex" value="[^0-9a-za-z]"/> </root>
bank.aiml
<?xml version="1.0" encoding="utf-8"?> <aiml> <category> <pattern>*</pattern> <template> <random> <li>ัะตัั</li> </random> </template> </category> </aiml>
Comments
Post a Comment