AIMLProcessorExtension: tag not working in aiml

怎甘沉沦 提交于 2019-12-08 03:51:22

问题


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 answerfor 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!