Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java Libraries for Accessing the Princeton Wordnet

Similar presentations


Presentation on theme: "Java Libraries for Accessing the Princeton Wordnet"— Presentation transcript:

1 Java Libraries for Accessing the Princeton Wordnet
丁基伟

2 主要参考文献 Java Libraries for Accessing the Princeton Wordnet: Comparison and Evaluation JWI与其他WordnetAPI的对比 MIT Java Wordnet Interface(JWI) User’s Guide 用户手册及常见问题 JWI 2.4.0(MIT Java Wordnet Interface) Javadocs 官方API文档

3 已有WordnetAPI

4 已有WordnetAPI的数据接入能力

5 主要接口 IDictionary 字典接口,存储管理整个Wordnet IIndexWord 表示拥有特定词性的lemma(词元)
IWord 表示一个词的一个意向 ISynset 表示同义词(意向)构成的集合 IPointer 表示存在于IWord之间或Isynset之间的边

6 家犬 单调乏味的人 单调乏味的

7 初始化 public static IDictionary dict=null; public static void init() throws IOException { URL url= new URL("file",null,"lib/Wordnet/dict"); dict=new Dictionary(url); dict.open(); } //可以使用RAMDictionary类将wordnet完全导入内存,详见参考文献2。

8 查找一个词的同义词 public void getSynonyms( IDictionary dict ) { //查找"dog"作为名词的第一个意向对应的Synset IIndexWord idxWord = dict.getIndexWord("dog", POS.NOUN ) ; IWordID wordID = idxWord.getWordIDs().get(0) ; //第一个含义 IWord word = dict.getWord( wordID ) ; ISynset synset = word.getSynset() ; //取出该Synset中其他词汇 for( IWord w:synset.getWords() ) System.out.println( w.getLemma() ) ; }

9 查找一个词的上位词 public void getSynonyms( IDictionary dict ) { //查找"dog"作为名词的第一个意向对应的Synset(略,见上一页PPT) //取出该Synset的所有上位Synset List <ISynsetID> hypernyms = synset.getRelatedSynsets(Pointer.HYPERNYM); //输出 List <IWord> words ; for( ISynsetID sid:hypernyms ) { words = dict.getSynset( sid ).getWords() ; System.out.println( sid + "{"+ words+"}") ;//注意这里输出的是IWord } //使用getRelatedMap方法可以查看与Synset或Word关联的所有类型边; 对IWord对象使用getRelatedWords方法可查看与它关联的某种特定边。

10 反义词 整体-部分 上位词 下位词 部分-整体

11 谢谢 欢迎提问


Download ppt "Java Libraries for Accessing the Princeton Wordnet"

Similar presentations


Ads by Google