我正在尝试使用程序 AB、aiml 和 android studio 构建一个聊天机器人。我把我所有的目标文件放在资产文件夹中:像这样assets/bots/alice2/aiml files(including sets, maps, aiml, aimlif and config)
然后我创建我的机器人并尝试通过这段代码连接到它:
String botname="alice2";
String path = "file:///android_asset";
Bot alice2 = new Bot(botname,path);
Chat chatSession = new Chat(alice2);
String request = mEdit.getText().toString();
String response = chatSession.multisentenceRespond(request);
((Button)v).setText(response);
但似乎连接到 aiml 文件时出现问题,因为无论我作为请求发送什么,我收到的唯一响应是“我对此没有答案”,它集成在其中。
我在 logcat 中看到的是该项目最初可以找到 aiml 文件,但后来它说它们不存在!有谁知道为什么会这样?这是 logcat 中的内容:
8611-8611/com.example.myapplication I/System.out? Name = alice2 Path = file:///android_asset/bots/alice2
10-24 13:04:46.162 8611-8611/com.example.myapplication I/System.out? c:/ab
10-24 13:04:46.162 8611-8611/com.example.myapplication I/System.out? **file:///android_asset/bots**
10-24 13:04:46.162 8611-8611/com.example.myapplication I/System.out? file:///android_asset/bots/**alice2**
10-24 13:04:46.162 8611-8611/com.example.myapplication I/System.out? file:///android_asset/bots/alice2/**aiml**
10-24 13:04:46.162 8611-8611/com.example.myapplication I/System.out? file:///android_asset/bots/alice2/**aimlif**
10-24 13:04:46.162 8611-8611/com.example.myapplication I/System.out? file:///android_asset/bots/alice2/**config**
10-24 13:04:46.162 8611-8611/com.example.myapplication I/System.out? file:///android_asset/bots/alice2/**logs**
10-24 13:04:46.162 8611-8611/com.example.myapplication I/System.out? file:///android_asset/bots/alice2/**sets**
10-24 13:04:46.162 8611-8611/com.example.myapplication I/System.out? file:///android_asset/bots/alice2/**maps**
10-24 13:04:46.162 8611-8611/com.example.myapplication I/System.out? Preprocessor: 0 norms 0 persons 0 person2
10-24 13:04:46.162 8611-8611/com.example.myapplication I/System.out? Get Properties: file:///android_asset/bots/alice2/config/**properties.txt**
10-24 13:04:46.172 8611-8611/com.example.myapplication I/System.out? addAIMLSets: file:///android_asset/bots/alice2/**sets does not exist.**
10-24 13:04:46.172 8611-8611/com.example.myapplication I/System.out? Loaded 0 set elements.
10-24 13:04:46.172 8611-8611/com.example.myapplication I/System.out? addAIMLMaps: file:///android_asset/bots/alice2/**maps does not exist.**
10-24 13:04:46.172 8611-8611/com.example.myapplication I/System.out? Loaded 0 map elements
10-24 13:04:46.172 8611-8611/com.example.myapplication I/System.out? Read pronouns: []
10-24 13:04:46.222 8611-8611/com.example.myapplication I/System.out? AIML modified Thu Jan 01 03:30:00 GMT+03:30 1970 AIMLIF modified Thu Jan 01 03:30:00 GMT+03:30 1970
10-24 13:04:46.222 8611-8611/com.example.myapplication I/System.out? addCategoriesFromAIMLIF: file:///android_asset/bots/alice2/**aimlif does not exist.**
10-24 13:04:46.222 8611-8611/com.example.myapplication I/System.out? Loaded 0 categories in 0.002 sec
10-24 13:04:46.222 8611-8611/com.example.myapplication I/System.out? **No AIMLIF Files found.** Looking for AIML
10-24 13:04:46.222 8611-8611/com.example.myapplication I/System.out? addCategoriesFromAIML: file:///android_asset/bots/alice2/**aiml does not exist.**