如何使用AIML <oob>标签

时间:2015-11-30 21:07:02

标签: tags aiml

我是使用<oob>标签的新手,我正在使用pandora-bot进行聊天机器人。 我使用了很多aiml标签并完成了我的工作。请指导如何在aiml中使用oob标记,以便在android编程中实现其响应。

如果有任何不清楚的地方,请随时提问 oob标签正在响应,但没有打开搜索或拨打电话。

1 个答案:

答案 0 :(得分:0)

 private static String recursEval(Node node, ParseState ps) {
    LOG.info("AIMLProcessor.recursEval(node: " + node + ", ps: " + ps + ")");
    try {
    LOG.info("in AIMLProcessor.recursEval(), node string: " + DomUtils.nodeToString(node));
    String nodeName = node.getNodeName();
    LOG.info("in AIMLProcessor.recursEval(), nodeName: " + nodeName);
    LOG.info("in AIMLProcessor.recursEval(), node.getNodeValue(): " + node.getNodeValue());
    if (nodeName.equals("#text")) return node.getNodeValue();
    else if (nodeName.equals("#comment")) {
        LOG.info("in AIMLProcessor.recursEval(), comment = "+node.getTextContent());
        return "";
    }
    else if (nodeName.equals("template"))
        return evalTagContent(node, ps, null);
    else if (nodeName.equals("random"))
        return random(node, ps);
    else if (nodeName.equals("condition"))
        return loopCondition(node, ps);
    else if (nodeName.equals("srai"))
        return srai(node, ps);
    else if (nodeName.equals("sr"))
          return respond(ps.starBindings.inputStars.star(0), ps.that, ps.topic, ps.chatSession, sraiCount);
    else if (nodeName.equals("sraix"))
        return sraix(node, ps);
    else if (nodeName.equals("set"))
        return set(node, ps);
    else if (nodeName.equals("get"))
        return get(node, ps);
    else if (nodeName.equals("map"))  // AIML 2.0 -- see also <set> in pattern
        return map(node, ps);
    else if (nodeName.equals("bot"))
        return bot(node, ps);
    else if (nodeName.equals("id"))
        return id(node, ps);
    else if (nodeName.equals("size"))
        return size(node, ps);
    else if (nodeName.equals("vocabulary")) // AIML 2.0
        return vocabulary(node, ps);
    else if (nodeName.equals("program"))
        return program(node, ps);
    else if (nodeName.equals("date"))
        return date(node, ps);
    else if (nodeName.equals("interval"))
        return interval(node, ps);
    //else if (nodeName.equals("gossip"))       // removed from AIML 2.0
    //    return gossip(node, ps);
    else if (nodeName.equals("think"))
        return think(node, ps);
    else if (nodeName.equals("system"))
        return system(node, ps);
    else if (nodeName.equals("explode"))
        return explode(node, ps);
    else if (nodeName.equals("normalize"))
        return normalize(node, ps);
    else if (nodeName.equals("denormalize"))
        return denormalize(node, ps);
    else if (nodeName.equals("uppercase"))
        return uppercase(node, ps);
    else if (nodeName.equals("lowercase"))
        return lowercase(node, ps);
    else if (nodeName.equals("formal"))
        return formal(node, ps);
    else if (nodeName.equals("sentence"))
        return sentence(node, ps);
    else if (nodeName.equals("person"))
        return person(node, ps);
    else if (nodeName.equals("person2"))
        return person2(node, ps);
    else if (nodeName.equals("gender"))
        return gender(node, ps);
    else if (nodeName.equals("star"))
        return inputStar(node, ps);
    else if (nodeName.equals("thatstar"))
        return thatStar(node, ps);
    else if (nodeName.equals("topicstar"))
        return topicStar(node, ps);
    else if (nodeName.equals("that"))
        return that(node, ps);
    else if (nodeName.equals("input"))
        return input(node, ps);
    else if (nodeName.equals("request"))
        return request(node, ps);
    else if (nodeName.equals("response"))
        return response(node, ps);
    else if (nodeName.equals("learn") || nodeName.equals("learnf"))
        return learn(node, ps);
    else if (nodeName.equals("addtriple"))
        return addTriple(node, ps);
    else if (nodeName.equals("deletetriple"))
        return deleteTriple(node, ps);
    else if (nodeName.equals("javascript"))
        return javascript(node, ps);
    else if (nodeName.equals("select"))
        return select(node, ps);
    else if (nodeName.equals("uniq"))
        return uniq(node, ps);
    else if (nodeName.equals("first"))
        return first(node, ps);
    else if (nodeName.equals("rest"))
        return rest(node, ps);
    else if (nodeName.equals("resetlearnf"))
        return resetlearnf(node, ps);
    else if (nodeName.equals("resetlearn"))
        return resetlearn(node, ps);
    else if (extension != null && extension.extensionTagSet().contains(nodeName)) return extension.recursEval(node, ps) ;
    else return (genericXML(node, ps));
    } catch (Exception ex) {
        ex.printStackTrace();
        return "";
    }
}

你会在AIMLProcessor类的程序ab中找到类似这样的方法,你必须添加oob标签的实现。这是根据在调用必要函数的响应中找到的标记来解析来自aiml文件的响应的方法