PerlでWordNetを扱う
WordNet::QueryDataでWordNetの辞書を直接扱える。(Manual)
ちなみにWordNetとは、英語の意味辞書である。(くわしくはWordNet - Wikipedia)
use WordNet::QueryData; my $wn = WordNet::QueryData->new("./wordnet"); # WordNetのdictディレクトリ my $word = "negative"; foreach ($wn->queryWord($word)) { foreach ($wn->queryWord($_)) { print $_, ": ", join("\n ", $wn->querySense($_, "glos")),"\n"; foreach ($wn->queryWord($_, "ants")) { # 反義語 print " antonym: ", $_, ": ", join("\n ", $wn->querySense($_, "glos")),"\n"; } } }
negative#n#1: a reply of denial; "he answered in the negative" antonym: affirmative#n#1: a reply of affirmation; "he answered in the affirmative" negative#n#2: a piece of photographic film showing an image with light and shade or colors reversed negative#v#1: vote against; refuse to endorse; refuse to assent; "The President vetoed the bill" negative#a#1: characterized by or displaying negation or denial or opposition or resistance; having no positive features; "a negative outlook on life"; "a colorless negative personality"; "a negative evaluation"; "a negative reaction to an advertising campaign" antonym: neutral#a#4: possessing no distinctive quality or characteristics antonym: positive#a#1: characterized by or displaying affirmation or acceptance or certainty etc.; "a positive attitude"; "the reviews were all positive"; "a positive benefit"; "a positive demand" negative#a#2: expressing or consisting of a negation or refusal or denial antonym: affirmative#a#1: affirming or giving assent; "an affirmative decision"; "affirmative votes" negative#a#3: having the quality of something harmful or unpleasant; "ran a negative campaign"; "delinquents retarded by their negative outlook on life" negative#a#4: not indicating the presence of microorganisms or disease or a specific condition; "the HIV test was negative" antonym: positive#a#4: indicating existence or presence of a suspected condition or pathogen; "a positive pregnancy test" negative#a#5: reckoned in a direction opposite to that regarded as positive; "negative interest rates" antonym: positive#a#8: reckoned, situated or tending in the direction which naturally or arbitrarily is taken to indicate increase or progress or onward motion; "positive increase in graduating students" negative#a#6: less than zero; "a negative number" negative#a#7: designed or tending to discredit, especially without positive or helpful suggestions; "negative criticism" negative#a#8: having a negative charge; "electrons are negative" negative#a#9: involving disadvantage or harm; "minus (or negative) factors"
まだよく分かっていない。
あとnewするのに5秒くらいかかる。たぶんインデックスを読み込んでいる。そのあとは速い。