问题
Synonyms function of wordnet package misses obvious synonyms that the wordnet app does not. How to get that other data out of wordnet using R's wordnet package?
I am using R 3.4.4. App shows 9 senses of company
Sense 1 company -- (an institution created to conduct business; "he only invests in large well-established companies"; "he started the company in his garage") => institution, establishment -- (an organization founded and united for a specific purpose) Sense 2 company -- (small military unit; usually two or three platoons) => army unit -- (a military unit that is part of an army)
Sense 3 company, companionship, fellowship, society -- (the state of being with someone; "he missed their company"; "he enjoyed the society of his friends") => friendship, friendly relationship -- (the state of being friends (or friendly))
```R
syns<-vector()
filter <- getTermFilter("ExactMatchFilter", "company", TRUE)
for(i in c("ADJECTIVE", "ADVERB", "NOUN", "VERB")){
try({
terms <- getIndexTerms( i, 1, filter)
gsyn<-getSynonyms(terms[[1]])
synsets <- getSynsets(terms[[1]])
related <- getRelatedSynsets(synsets[[1]], "+")
gsyn <- c(gsyn,unlist(sapply(related, getWord)))
if(length(gsyn)>0){
syns <- c(syns,i)
syns <- c(syns,unique(gsyn))
}
}, silent = T)
}
print(syns)
```
[1] "NOUN" "caller"
[3] "companionship" "company"
[5] "fellowship" "party"
[7] "ship's company" "society"
[9] "troupe" "VERB"
[11] "accompany" "companion"
[13] "company" "keep company"
[15] "escort" "accompaniment"
[17] "fellow traveler" "fellow traveller"
[19] "comrade" "fellow"
[21] "familiar" "associate"
[23] "party"
Neither suggest business or => institution, establishment. Sense 3s " company, companionship, fellowship, society " all show up.
来源:https://stackoverflow.com/questions/58194311/synonyms-from-wordnet-package-are-very-incomplete