wordnet

Get synonyms from synset returns error - Python

早过忘川 提交于 2019-12-03 08:59:07
I'm trying to get synonyms of a given word using Wordnet. The problem is that despite I'm doing the same as is written here: here , it returns error. Here is my code: from nltk.corpus import wordnet as wn import nltk dog = wn.synset('dog.n.01') print dog.lemma_names >>> <bound method Synset.lemma_names of Synset('dog.n.01')> for i,j in enumerate(wn.synsets('small')): print "Synonyms:", ", ".join(j.lemma_names) >>> Synonyms: Traceback (most recent call last): File "C:/Users/Python/PycharmProjects/PribliznostneVyhladavanie/testy.py", line 38, in <module> print "Synonyms:", ", ".join(j.lemma

Using Sentiwordnet 3.0

孤街醉人 提交于 2019-12-03 08:07:17
I plan on using Sentiwordnet 3.0 for Sentiment classification. Could someone clarify as to what the numbers associated with words in Sentiwordnet represent? For e.g. what does 5 in rank#5 mean? Also for POS what is the letter used to represent adverbs? Im assuming 'a' is adjectives. I could not find an explanation either on their site or on other sites. I found the answer. Seems like the number notation comes form Wordnet. It represents the rank in which the given word is commonly used. So rank#5 refers to the context in which rank is used 5th most commonly. Similarly rank#1 refers to the

How to Normalize similarity measures from Wordnet

一笑奈何 提交于 2019-12-03 07:44:29
I am trying to calculate semantic similarity between two words. I am using Wordnet-based similarity measures i.e Resnik measure(RES), Lin measure(LIN), Jiang and Conrath measure(JNC) and Banerjee and Pederson measure(BNP). To do that, I am using nltk and Wordnet 3.0. Next, I want to combine the similarity values obtained from different measure. To do that i need to normalize the similarity values as some measure give values between 0 and 1, while others give values greater than 1. So, my question is how do I normalize the similarity values obtained from different measures. Extra detail on what

Sentence Similarity using WS4J

不想你离开。 提交于 2019-12-03 03:46:16
I want to use ws4j to calculate similarity between two sentence. I am using the Online Demo of WS4J @ WS4J Online demo I am using the default example sentences given by WS4J. After entering the sentence and hitting on calculate similarity button, i am getting the following output: Here i am getting the similarity between individual tokens of the sentence. How do i proceed further from here.I want to get a single value (say 0.5 or 0.8) which denotes the similarity of these 2 sentences. Is there a standard way of proceeding from here or will i have to write my own algorithm? Klerisson will i

Measuring semantic similarity between two phrases [closed]

时光毁灭记忆、已成空白 提交于 2019-12-03 03:17:21
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I want to measure semantic similarity between two phrases/sentences. Is there any framework that I can use directly and reliably? I have already checked out this question, but its pretty old and I couldn't find real helpful answer there. There was one link, but I found this unreliable. e.g.: I have a phrase:

Is it possible to speed up Wordnet Lemmatizer?

半腔热情 提交于 2019-12-03 02:31:43
I'm using the Wordnet Lemmatizer via NLTK on the Brown Corpus (to determine if the nouns in it are used more in their singular form or their plural form). i.e. from nltk.stem.wordnet import WordNetLemmatizer l = WordnetLemmatizer() I've noticed that even the simplest queries such as the one below takes quite a long time (at least a second or two). l("cats") Presumably this is because a web connection must be made to Wordnet for each query?.. I'm wondering if there is a way to still use the Wordnet Lemmatizer but have it perform much faster? For instance, would it help at all for me to download

Resource &#039;corpora/wordnet&#039; not found on Heroku

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to get NLTK and wordnet working on Heroku. I've already done heroku run python nltk.download() wordnet pip install -r requirements.txt But I get this error: Resource 'corpora/wordnet' not found. Please use the NLTK Downloader to obtain the resource: >>> nltk.download() Searched in: - '/app/nltk_data' - '/usr/share/nltk_data' - '/usr/local/share/nltk_data' - '/usr/lib/nltk_data' - '/usr/local/lib/nltk_data' Yet, I've looked at in /app/nltk_data and it's there, so I'm not sure what's going on. 回答1: I just had this same problem. What

NLTK WordNet Lemmatizer: Shouldn&#039;t it lemmatize all inflections of a word?

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using the NLTK WordNet Lemmatizer for a Part-of-Speech tagging project by first modifying each word in the training corpus to its stem (in place modification), and then training only on the new corpus. However, I found that the lemmatizer is not functioning as I expected it to. For example, the word loves is lemmatized to love which is correct, but the word loving remains loving even after lemmatization. Here loving is as in the sentence "I'm loving it". Isn't love the stem of the inflected word loving ? Similarly, many other 'ing' forms

Is wordnet path similarity commutative?

匿名 (未验证) 提交于 2019-12-03 02:00:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using the wordnet API from nltk. When I compare one synset with another I got None but when I compare them the other way around I get a float value. Shouldn't they give the same value? Is there an explanation or is this a bug of wordnet? Example: wn.synset('car.n.01').path_similarity(wn.synset('automobile.v.01')) # None wn.synset('automobile.v.01').path_similarity(wn.synset('car.n.01')) # 0.06666666666666667 回答1: Technically without the dummy root, both car and automobile synsets would have no link to each other: >>> from nltk.corpus

Import WordNet In NLTK

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to import wordnet dictionary but when i import Dictionary form wordnet i see this error : for l in open(WNSEARCHDIR+'/lexnames').readlines(): IOError: [Errno 2] No such file or directory: 'C:\\Program Files\\WordNet\\2.0\\dict/lexnames' I install wordnet2.1 in this directory but i cant import please help me to solve this problem import nltk from nltk import * from nltk.corpus import wordnet from wordnet import Dictionary print '-----------------------------------------' print Dictionary.length 回答1: The following works for me: >>> nltk