问题
I am trying to create my own tag in aiml
using program tab. The tag is not working. What is the problem?
Java code:
public class AIMLExtension implements AIMLProcessorExtension{
public Set<String> extensionTagNames = Utilities.stringSet("check");
@Override
public Set<String> extensionTagSet() {
// TODO Auto-generated method stub
return extensionTagNames;
}
private String contactId(Node node, ParseState ps) {
return "Success :P";
}
@Override
public String recursEval(Node node, ParseState ps) {
// TODO Auto-generated method stub
try {
String nodeName = node.getNodeName();
if (nodeName.equals("check"))
return contactId(node, ps);
else return (AIMLProcessor.genericXML(node, ps));
} catch (Exception ex) {
ex.printStackTrace();
return "";
}
}
}
AIML code: I am getting I have no answer
for the below code.
<category>
<pattern>CHECKING EXTENSION</pattern>
<template>RESTCALL <check> </template>
</category>
AIML code : I am getting RESTCALL <check/>
itself for the below code.
<category>
<pattern>CHECKING EXTENSION</pattern>
<template>RESTCALL <check/> </template>
</category>
回答1:
Explore program-ab and see how its tags work. I created a tag by replicating code for person tag in program ab code.
来源:https://stackoverflow.com/questions/43463390/aimlprocessorextension-tag-not-working-in-aiml