您可以使用Synset
的字的每個感測,然後在每個Synset
打印出來的字,如下所示:
IndexWord indexWord = proc.lookupBaseForm(POS.VERB,"bear");
int senseNum = 0;
for(Synset synset: indexWord.getSenses()){
senseNum++;
System.out.println("For sense: " + senseNum + " (" + synset.getGloss()+")");
Word[] words = synset.getWords();
for(Word word: words){
System.out.println("\t"+word.getLemma()+"("+word.getPOS()+")");
}
}
這將讓你:
For sense: 1 (have; "bear a resemblance"; "bear a signature")
bear([POS: verb])
For sense: 2 (cause to be born; "My wife had twins yesterday!")
give_birth([POS: verb])
deliver([POS: verb])
bear([POS: verb])
birth([POS: verb])
have([POS: verb])
For sense: 3 (put up with something or somebody unpleasant; "I cannot bear his constant criticism"; "The new secretary had to endure a lot of unprofessional remarks"; "he learned to tolerate the heat"; "She stuck out two years in a miserable marriage")
digest([POS: verb])
endure([POS: verb])
stick_out([POS: verb])
stomach([POS: verb])
bear([POS: verb])
stand([POS: verb])
tolerate([POS: verb])
support([POS: verb])
brook([POS: verb])
abide([POS: verb])
suffer([POS: verb])
put_up([POS: verb])
For sense: 4 (move while holding up or supporting; "Bear gifts"; "bear a heavy load"; "bear news"; "bearing orders")
bear([POS: verb])
For sense: 5 (bring forth, "The apple tree bore delicious apples this year"; "The unidentified plant bore gorgeous flowers")
bear([POS: verb])
turn_out([POS: verb])
For sense: 6 (take on as one's own the expenses or debts of another person; "I'll accept the charges"; "She agreed to bear the responsibility")
bear([POS: verb])
take_over([POS: verb])
accept([POS: verb])
assume([POS: verb])
For sense: 7 (contain or hold; have within; "The jar carries wine"; "The canteen holds fresh water"; "This can contains water")
hold([POS: verb])
bear([POS: verb])
carry([POS: verb])
contain([POS: verb])
For sense: 8 (bring in; "interest-bearing accounts"; "How much does this savings certificate pay annually?")
yield([POS: verb])
pay([POS: verb])
bear([POS: verb])
For sense: 9 (have on one's person; "He wore a red ribbon"; "bear a scar")
wear([POS: verb])
bear([POS: verb])
For sense: 10 (behave in a certain manner; "She carried herself well"; "he bore himself with dignity"; "They conducted themselves well during these difficult times")
behave([POS: verb])
acquit([POS: verb])
bear([POS: verb])
deport([POS: verb])
conduct([POS: verb])
comport([POS: verb])
carry([POS: verb])
For sense: 11 (have rightfully; of rights, titles, and offices; "She bears the title of Duchess"; "He held the governorship for almost a decade")
bear([POS: verb])
hold([POS: verb])
For sense: 12 (support or hold in a certain manner; "She holds her head high"; "He carried himself upright")
hold([POS: verb])
carry([POS: verb])
bear([POS: verb])
For sense: 13 (be pregnant with; "She is bearing his child"; "The are expecting another child in January"; "I am carrying his child")
have_a_bun_in_the_oven([POS: verb])
bear([POS: verb])
carry([POS: verb])
gestate([POS: verb])
expect([POS: verb])
但是,這所有的動詞,因爲我們正在查找動詞。如果你想獲得名詞(如Web版本所示),你應該做一些進一步的步驟。
它被稱爲「morphosemantic」盟友相關字,如this file中定義,如Wordnet website中所述。您可以創建自己的代碼,通過使用該文件中可用的映射來提取morphosemantically相關的單詞。
由於這是超出標準WordNet發行版的額外文件,遺憾的是我相信這不是在JWNL中實現的,所以如果您可以創建一個簡單的代碼來獲取映射,那麼可能是最好的。首先,您可以使用任何電子表格程序(如Excel)將xls文件轉換爲CSV文件。那麼你需要得到這種感覺的感覺鑰匙。不幸的是,JWNL(1.4.1 rc2)沒有簡單的方法來獲得感覺鑰匙。但是,它包含在JWNL(1.4 rc3)中,該類別是Synset
中的getSenseKey(lemma)
。因此,假設您升級到JWNL 1.4_rc3,你可以這樣做:
HashMap<String,ArrayList<String>> relatedWords = loadMorphosemanticFile();
...
relatedWords.get(word.getSynset().getSenseKey(word.getLemma()))
將返回一個ArrayList包括:birth%1:28:00::
,birth%1:22:00::
和birth%1:11:00::
這個詞的時候是bear
(傳感鍵熊感2 birth
%2:29:01 ::,原因是出生;「我的妻子昨天有雙胞胎!」),它具有意義上的關鍵出生%2:29:00 ::,如使用JWNL 1.4 rc3如下:
For sense: bear%2:29:01:: (cause to be born; "My wife had twins yesterday!")
give_birth (give_birth%2:29:00::)
deliver (deliver%2:29:01::)
bear (bear%2:29:01::)
birth (birth%2:29:00::)
have (have%2:29:00::)
我從GrepCode
0得到這個很好的資源
WordNet 3.0關閉文件:http://wordnet.princeton.edu/wordnet/download/standoff/ – myahya
您是否將該評論作爲自己的備註? – justhalf
否。您的文章中的相同鏈接是https,它並不總是有效。 Stackoverflow不允許編輯少於6個字符的變化。 – myahya