我们如何在同义词集中找到单词短语?特别是,将此同义词集用于形容词“booked”:
booked, engaged, set-aside -- (reserved in advance)
我用的是RitaWN Java包(WordNet版本是2.1),好像找不到词组。在上面的例子中,当我运行
RiWordnet wordnet = new RiWordnet(null);
String[] syn = wordnet.getSynset(word, "a", true);
for(int i = 0; i < syn.length; i++)
System.out.println(syn[i]);
它只输出
booked engaged
虽然没有列出“预留”。
我测试了很多,所有的短语都没有找到。另一个例子:
commodity, trade good, good -- (articles of commerce)
然后“贸易商品”不会从 getSynset() 方法返回。那么我们如何才能真正获得短语呢?
(ritawn包取自http://rednoise.org/rita/wordnet/documentation/index.htm)
最佳答案
RiTaWN 似乎默认忽略“复合词”。您可以禁用此功能以获取完整的短语列表(下面的第 2 行)。
RiWordnet wordnet = new RiWordnet();
wordnet.ignoreCompoundWords(false);
String[] syn = wordnet.getSynset("booked", "a", true);
System.out.println(Arrays.asList(syn));
结果:
[INFO] RiTa.WordNet.version [033]
[booked, engaged, set-aside]
关于java - synset 中的 wordnet 词组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13170473/