本文整理汇总了Java中gnu.prolog.term.VariableTerm类的典型用法代码示例。如果您正苦于以下问题:Java VariableTerm类的具体用法?Java VariableTerm怎么用?Java VariableTerm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VariableTerm类属于gnu.prolog.term包,在下文中一共展示了VariableTerm类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import gnu.prolog.term.VariableTerm; //导入依赖的package包/类
/**
* Converts a map of VariableTerms into a map of java objects
*/
public static Map<String,Object> convert(Map<String,VariableTerm> rawVars) {
HashMap<String,Object> result = new HashMap<>();
for (Entry<String,VariableTerm> entry : rawVars.entrySet()) {
if (entry.getKey().charAt(0) != '_') {
result.put(entry.getKey(), convert(entry.getValue()));
}
}
return result;
}
示例2: parseSentence
import gnu.prolog.term.VariableTerm; //导入依赖的package包/类
public List<Term> parseSentence(Term startCat, Term sentence) throws PrologException {
Term resultsTerm = new VariableTerm("Results");
Term goalTerm = new CompoundTerm("parse_all", new Term[]{startCat, sentence, resultsTerm});
int rc = interpreter.runOnce(goalTerm);
assert (rc == PrologCode.SUCCESS || rc == PrologCode.SUCCESS_LAST);
Term results = resultsTerm.dereference();
return collectResults(results);
}