我想使用extjwnl 库向 Wordnet 添加一个新的同义词集。为此,我编写了以下示例代码。保存后,我观察到确实添加了新的同义词和单词,但创建的语义指针(标识下义关系)没有保存。如何将指针与字典相关联?
JWNL.initialize(new FileInputStream(propsFile));
Dictionary dictionary = Dictionary.getInstance();
Iterator<Synset> synsets = dictionary.getSynsetIterator(POS.NOUN);
dictionary.edit();
Synset newSynset = new Synset(dictionary, POS.NOUN);
IndexWord newWord = new IndexWord(dictionary, "hublabooboo", POS.NOUN, newSynset);
Synset topmostSynset = synsets.next();
Pointer newPointer = new Pointer(PointerType.HYPONYM, topmostSynset, newSynset);
dictionary.save();