2015-04-03 60 views
0

我正在爲我的大學項目使用rita wordnet。我需要提取每個單詞的定義。當我使用getGloss()時,具有多個一個或多個定義的字符串將返回。由於我只想每個單詞有一個定義,因此我轉向getDescription()getGloss()vs rita wordnet中的getDescription()

所以我只是想知道,麗塔詞網中的每一個字都包含其定義getDescription()太或只是在getGloss() ??

此外,如果你可以請幫助我這個..如何檢索麗塔詞網的文字?我找不到任何方法來檢索像getWord()或類似的東西?

回答

2

所以我只是想知道,麗塔wordnet中的每一個字都包含其在getDescription()中的定義,或者只是在getGloss()?

getDescription()返回定義; getGloss()返回定義加一個例句(gloss?)。

看起來像getGloss()是RiTa中getDescription()的超集。

以下是這些方法在rita.RiWordNet.java的實現:

/** 
    * Returns full gloss for 1st sense of 'word' with 'pos' 
    */ 
    public String getGloss(String word, String pos) 
    { 
    Synset synset = getSynsetAtIndex(word, pos, 1); 
    return getGloss(synset); 
    } 

    /** 
    * Returns description for <code>word</code> with <code>pos</code> or null if 
    * not found 
    */ 
    public String getDescription(String word, String pos) 
    { 
    String gloss = getGloss(word, pos); 
    return WordnetUtil.parseDescription(gloss); 
    } 

如何從麗塔共發現檢索詞?

不確定要檢索哪種字詞。如果你在談論單詞定義,我相信你可以通過getAllGlosses()和getAllSynsets()來實現。你甚至可以寫一個getAllDescription()來處理。

或檢查RiTa圖書館here的參考資料以尋找您所需的方法。

0

documentation顯示'getDescription()'已被刪除。您可以根據需要使用getGloss()或getExamples()或getSynset()。一些示例:

RiWordNet ww = new RiWordNet("/path/to/WordNet"); System.out.println(Arrays.asList(rw.getSynset("dog", "n", 1))); System.out.println(Arrays.asList(rw.getAllGlosses("dog", "n"))); System.out.println(Arrays.asList(rw.getGloss("dog", "n"))); System.out.println(Arrays.asList(rw.getExamples("dog", "n")));