首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SimpleNLG模型中的TextSpec不可用

SimpleNLG模型中的TextSpec不可用
EN

Stack Overflow用户
提问于 2015-08-14 04:03:45
回答 1查看 164关注 0票数 0

我希望使用链接:https://code.google.com/p/simplenlg/wiki/Section16中提到的TextSpec类来组合两个句子。但是看起来这个类不再可用了。有人能在这方面给我指点一下吗?

EN

回答 1

Stack Overflow用户

发布于 2015-08-14 05:39:35

本教程的这一部分是deprecated.TextSpec是SimpleNLG早期版本的一部分,该版本已不再存在。如果我们想创建预制文本子句,我们可以使用一个StringElement (https://cdn.rawgit.com/simplenlg/simplenlg/master/docs/javadoc/simplenlg/framework/StringElement.html)并将它们添加到一个CoordinatedPhraseElement中,以便将它们聚合在一起,如下所示:

代码语言:javascript
复制
 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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31997413

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档