我希望使用链接:https://code.google.com/p/simplenlg/wiki/Section16中提到的TextSpec类来组合两个句子。但是看起来这个类不再可用了。有人能在这方面给我指点一下吗?
发布于 2015-08-14 05:39:35
本教程的这一部分是deprecated.TextSpec是SimpleNLG早期版本的一部分,该版本已不再存在。如果我们想创建预制文本子句,我们可以使用一个StringElement (https://cdn.rawgit.com/simplenlg/simplenlg/master/docs/javadoc/simplenlg/framework/StringElement.html)并将它们添加到一个CoordinatedPhraseElement中,以便将它们聚合在一起,如下所示:
NLGFactory factory = new NLGFactory(lexicon);
Realiser realiser = new Realiser(lexicon);
CoordinatedPhraseElement coordinate = factory.createCoordinatedPhrase(new StringElement("John is going to Tesco"), new StringElement("Mary is going to Sainsburys"));
SPhraseSpec sentence = factory.createClause();
sentence.addComplement(coordinate);
String text = realiser.realiseSentence(sentence);生成以下输出:
约翰要去特易购,玛丽要去桑斯伯里。
最后,SimpleNLG迁移到了GitHub:https://github.com/simplenlg/simplenlg。当前维护的教程版本可以在这里找到:https://github.com/simplenlg/simplenlg/wiki/Section-0---SimpleNLG- tutorial
https://stackoverflow.com/questions/31997413
复制相似问题