Java 始终“;我对此没有答案;从自定义类运行时程序ab中的响应
我正在尝试使用ab程序创建自定义聊天机器人。下面是我创建的类Java 始终“;我对此没有答案;从自定义类运行时程序ab中的响应,java,aiml,Java,Aiml,我正在尝试使用ab程序创建自定义聊天机器人。下面是我创建的类 public class Test{ public static void main(String args[]){ String botname="super"; String path="F:/Jars/NLP"; Bot bot = new Bot(botname, path); Chat chatSession = new Chat(bot);
public class Test{
public static void main(String args[]){
String botname="super";
String path="F:/Jars/NLP";
Bot bot = new Bot(botname, path);
Chat chatSession = new Chat(bot);
Scanner sc=new Scanner(System.in);
String request = "Hello";
do{
request = sc.next();
String response = chatSession.multisentenceRespond(request);
System.out.println(response);
}while(!request.equals("exit"));
}}
当我运行这个类时,我得到以下输出
Name = super Path = F:/Jars/NLP/bots/super
c:/ab
F:/Jars/NLP/bots
F:/Jars/NLP/bots/super
F:/Jars/NLP/bots/super/aiml
F:/Jars/NLP/bots/super/aimlif
F:/Jars/NLP/bots/super/config
F:/Jars/NLP/bots/super/logs
F:/Jars/NLP/bots/super/sets
F:/Jars/NLP/bots/super/maps
Preprocessor: 0 norms 0 persons 0 person2
Get Properties: F:/Jars/NLP/bots/super/config/properties.txt
Loading AIML Sets files from F:/Jars/NLP/bots/super/sets
Loading AIML Map files from F:/Jars/NLP/bots/super/maps
AIML modified Thu Jun 15 19:03:38 IST 2017 AIMLIF modified Thu Jun 15 19:32:05 I
ST 2017
No deleted.aiml.csv file found
No deleted.aiml.csv file found
Loading AIML files from F:/Jars/NLP/bots/super/aimlif
Reading Learnf file
Loaded 2 categories in 0.015 sec
--> Bot super 2 completed 0 deleted 0 unfinished
Setting predicate topic to unknown
I like Mango
normalized = I
No match.
writeCertainIFCaegories learnf.aiml size= 0
I have no answer for that.
normalized = like
No match.
writeCertainIFCaegories learnf.aiml size= 0
I have no answer for that.
normalized = Mango
No match.
writeCertainIFCaegories learnf.aiml size= 0
I have no answer for that.
我的AIML文件
星空
<?xml version = "1.0" encoding = "UTF-8"?>
<aiml>
<category>
<pattern>I LIKE *</pattern>
<template>
I too like <star/>.
</template>
</category>
<category>
<pattern>A * IS A *</pattern>
<template>
How <star index = "1"/> can not be a <star index = "2"/>?
</template>
</category>
</aiml>
有人能告诉我定制类有什么问题吗最后我得到了答案
import java.util.Scanner;
import org.alicebot.ab.AB;
import org.alicebot.ab.Bot;
import org.alicebot.ab.Chat;
import org.alicebot.ab.PCAIMLProcessorExtension;
import org.alicebot.ab.utils.IOUtils;
public class Test_001 {
public static void main(String args[]){
String botname="super";
String path="F:/Jars/NLP";
org.alicebot.ab.AIMLProcessor.extension = new PCAIMLProcessorExtension();
Bot bot = new Bot(botname, path,"chat");
Chat chatSession = new Chat(bot);
AB.ab(bot);
Scanner sc=new Scanner(System.in);
String request = "Hello";
do{
request = IOUtils.readInputTextLine();
String response = chatSession.multisentenceRespond(request);
System.out.println(response);
}while(!request.equals("exit"));
}
}
你在问你没有给我们看的代码有什么问题?我已经给出了我创建的所有文件。还提供了自定义类。
java -cp lib/Ab.jar Main bot=super action=chat trace=false
import java.util.Scanner;
import org.alicebot.ab.AB;
import org.alicebot.ab.Bot;
import org.alicebot.ab.Chat;
import org.alicebot.ab.PCAIMLProcessorExtension;
import org.alicebot.ab.utils.IOUtils;
public class Test_001 {
public static void main(String args[]){
String botname="super";
String path="F:/Jars/NLP";
org.alicebot.ab.AIMLProcessor.extension = new PCAIMLProcessorExtension();
Bot bot = new Bot(botname, path,"chat");
Chat chatSession = new Chat(bot);
AB.ab(bot);
Scanner sc=new Scanner(System.in);
String request = "Hello";
do{
request = IOUtils.readInputTextLine();
String response = chatSession.multisentenceRespond(request);
System.out.println(response);
}while(!request.equals("exit"));
}
}