- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何从wordnet生成更一般、不太一般和等价关系?
RitaWordnet 中的 wordnet 相似度给出类似 -1.0、0.222 或 1.0 的数字,但如何得出单词之间更一般、不太一般的关系?哪个工具最适合这个?请帮助我
打印后我得到 java.lang.NullPointerException“全音是”
package wordnet;
import rita.wordnet.RiWordnet;
public class Main {
public static void main(String[] args) {
try {
// Would pass in a PApplet normally, but we don't need to here
RiWordnet wordnet = new RiWordnet();
wordnet.setWordnetHome("/usr/share/wordnet/dict");
// Demo finding parts of speech
String word = "first name";
System.out.println("\nFinding parts of speech for " + word + ".");
String[] partsofspeech = wordnet.getPos(word);
for (int i = 0; i < partsofspeech.length; i++) {
System.out.println(partsofspeech[i]);
}
//word = "eat";
String pos = wordnet.getBestPos(word);
System.out.println("\n\nDefinitions for " + word + ":");
// Get an array of glosses for a word
String[] glosses = wordnet.getAllGlosses(word, pos);
// Display all definitions
for (int i = 0; i < glosses.length; i++) {
System.out.println(glosses[i]);
}
// Demo finding a list of related words (synonyms)
//word = "first name";
String[] poss = wordnet.getPos(word);
for (int j = 0; j < poss.length; j++) {
System.out.println("\n\nSynonyms for " + word + " (pos: " + poss[j] + ")");
String[] synonyms = wordnet.getAllSynonyms(word, poss[j], 10);
for (int i = 0; i < synonyms.length; i++) {
System.out.println(synonyms[i]);
}
}
// Demo finding a list of related words
// X is Hypernym of Y if every Y is of type X
// Hyponym is the inverse
//word = "nurse";
pos = wordnet.getBestPos(word);
System.out.println("\n\nHyponyms for " + word + ":");
String[] hyponyms = wordnet.getAllHyponyms(word, pos);
//System.out.println(hyponyms.length);
//if(hyponyms!=null)
for (int i = 0; i < hyponyms.length; i++) {
System.out.println(hyponyms[i]);
}
System.out.println("\n\nHypernyms for " + word + ":");
String[] hypernyms = wordnet.getAllHypernyms(word, pos);
//if(hypernyms!=null)
for (int i = 0; i < hypernyms.length; i++) {
System.out.println(hypernyms[i]);
}
System.out.println("\n\nHolonyms for " + word + ":");
String[] holonyms = wordnet.getAllHolonyms(word, pos);
//if(holonyms!=null)
for (int i = 0; i < holonyms.length; i++) {
System.out.println(holonyms[i]);
}
System.out.println("\n\nmeronyms for " + word + ":");
String[] meronyms = wordnet.getAllMeronyms(word, pos);
if(meronyms!=null)
for (int i = 0; i < meronyms.length; i++) {
System.out.println(meronyms[i]);
}
System.out.println("\n\nAntonym for " + word + ":");
String[] antonyms = wordnet.getAllAntonyms(word, pos);
if(antonyms!=null)
for (int i = 0; i < antonyms.length; i++) {
System.out.println(antonyms[i]);
}
String start = "cameras";
String end = "digital cameras";
pos = wordnet.getBestPos(start);
// Wordnet can find relationships between words
System.out.println("\n\nRelationship between: " + start + " and " + end);
float dist = wordnet.getDistance(start, end, pos);
String[] parents = wordnet.getCommonParents(start, end, pos);
System.out.println(start + " and " + end + " are related by a distance of: " + dist);
// These words have common parents (hyponyms in this case)
System.out.println("Common parents: ");
if (parents != null) {
for (int i = 0; i < parents.length; i++) {
System.out.println(parents[i]);
}
}
//wordnet.
// System.out.println("\n\nHypernym Tree for " + start);
// int[] ids = wordnet.getSenseIds(start,wordnet.NOUN);
// wordnet.printHypernymTree(ids[0]);
} catch (Exception e) {
e.printStackTrace();
}
}
}
最佳答案
Rita wordnet 确实提供了用于查找上位词(更通用)、下位词(不太通用)和同义词的 API。查看以下页面了解详细信息:-
http://www.rednoise.org/rita/wordnet/documentation/index.htm
要了解所有这些术语(上位词等),请查看 wordnet 的维基百科页面。
关于java - 词网关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3977100/
我正在寻找的服务器是: 轻量级, 非 buggy , 支持.NET, 在客户端上运行以进行测试, 在Windows上运行 Cassinni太过马车,IIS太昂贵,Apache很难安装,XSP仅是lin
所以我有大约10个短的css文件,可以与mvc应用程序一起使用。 有像 error.css login.css 等等... 仅有一些非常短的CSS文件,这些文件使更新和编辑变得容易(至少对我而言)。我
我正在编写程序来自动化 win32 表单。我正在使用 Microsoft UI 自动化库。我不知道如何获取和调用该表单上的预定义快捷键。现在我只需获取 MenuItem 的 AutomationEle
我有一个在后台线程上运行的及时操作。运行时,我当前将光标置于等待状态: Mouse.OverrideCursor = Cursors.Wait 我刚刚实现了一项功能,允许用户在厌倦等待时单击“取消”按
如何找到所有可能直接或间接调用给定方法的单元测试?当我更改方法时,我希望知道要运行的最佳测试;必须有一个工具! 因为我们有很多接口(interface),所以我对所有调用接口(interface)方法
我想知道,一个类会被装箱吗?我一直假设每个类都有一个虚拟表,可以用来标识类,所以它需要装箱吗? 最佳答案 只有值类型(结构)被装箱。类实例不会被装箱。 关于.net - 类是盒装的吗? 。网,我们在S
所以接下来有一个按钮调用(页面)。它的 href 链接是 site/blah/#。所以我知道它真正运行的 javascript 代码。在我解析完第一页后,我想解析下一页。我如何模拟鼠标点击,以便我可以
我想知道是否有人对解决以下设计问题有好的建议/模式。我有一个命令类的层次结构。在最抽象的层面上,我有一个 ICommand 接口(interface)。执行 ICommand 的 RunCommand
我在资源(xsd 文件)中有几个文件可用于验证收到的 xml 消息。我使用的资源文件名为 AppResources.resx,它包含一个名为 clientModels.xsd 的文件。当我尝试使用这样
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求提供代码的问题必须表现出对所解决问题的最低限度理解。包括尝试过的解决方案、为什么它们不起作用,以及预
(最后的简短版本) 我目前正在开发的软件需要跟踪任意数量的 MS Office 文件,现在需要提供将所有这些文件一起打印的功能,以及一些应用程序数据(可能会发送到打印机作为 .xps、.html 或
我想在不指定命名空间或程序集的情况下按名称(字符串)实例化一个类。像这样(Unity 语法): var processor = container.Resolve("SpecialProcessor"
我有一些代码可以对 64 位整数进行大量比较,但是它必须考虑数字的长度,就好像它被格式化为字符串一样。我无法更改调用代码,只能更改函数。 最简单的方法(除了 .ToString().Length 之外
使用遗留代码,我发现我有很多这样的语句(超过 500 个) bool isAEqualsB = (a == b) ? true : false; 这样重写有意义吗? bool isAEqualsB =
我有这个: AudioPlayer player = new AudioPlayer(); player.Directory = vc.Directory; player.StartTime = vc
我已经阅读了很多关于双重检查锁定的危险的文章,我会努力远离它,但话虽如此,我认为他们的阅读非常有趣。 我正在阅读 Joe Duffy 的这篇关于使用双重检查锁定实现单例的文章: http://www.
对于可变类型,值类型和引用类型之间的行为差异很明显: // Mutable value type PointMutStruct pms1 = new PointMutStruct(1, 2); P
关闭。这个问题需要更多 focused .它目前不接受答案。 想要改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 6 年前。 Improve this q
我有一个 Cordova pp 我在 Controller 中调用post方法 它可以在浏览器中工作,但是在构建和调试apk时出现错误 ionic.bundle.js:23826 POST http:
我们正在尝试将时间戳附加到某些 URL 以让内容缓存但在它们发生更改时更新它们。我们有代码可以归结为: DateTime ts = File.GetLastWriteTime(absPath); 其中
我是一名优秀的程序员,十分优秀!