wordnet

Using WN-Affect to detect emotion/mood of a string

北城以北 提交于 2019-11-27 05:45:51
问题 I downloaded WN-Affect. I am however not sure how to use it to detect the mood of a sentence. For example if I have a string "I hate football." I want to be able to detect whether the mood is bad and the emotion is fear. WN-Affect has no tutorial on how to do it, and I am kind of new to python. Any help would be great! 回答1: In short : Use SentiWordNet instead and look at https://github.com/kevincobain2000/sentiment_classifier In Long : Affectedness vs Sentiment The line between affect and

How do I find the frequency count of a word in English using WordNet?

邮差的信 提交于 2019-11-27 05:20:29
问题 Is there a way to find the frequency of the usage of a word in the English language using WordNet or NLTK using Python? NOTE: I do not want the frequency count of a word in a given input file. I want the frequency count of a word in general based on the usage in today's time. 回答1: In WordNet, every Lemma has a frequency count that is returned by the method lemma.count() , and which is stored in the file nltk_data/corpora/wordnet/cntlist.rev . Code example: from nltk.corpus import wordnet syns

Finding related words (specifically physical objects) to a specific word

依然范特西╮ 提交于 2019-11-27 05:07:42
问题 I am trying to find words (specifically physical objects) related to a single word. For example: Tennis : tennis racket, tennis ball, tennis shoe Snooker : snooker cue, snooker ball, chalk Chess : chessboard, chess piece Bookcase : book I have tried to use WordNet, specifically the meronym semantic relationship; however, this method is not consistent as the results below show: Tennis : serve, volley, foot-fault, set point, return, advantage Snooker : nothing Chess : chess move, checkerboard

Extract Word from Synset using Wordnet in NLTK 3.0

谁都会走 提交于 2019-11-27 04:50:50
Some time ago, someone on SO asked how to retrieve a list of words for a given synset using NLTK's wordnet wrapper. Here is one of the suggested responses: for synset in wn.synsets('dog'): print synset.lemmas[0].name Running this code with NLTK 3.0 yields TypeError: 'instancemethod' object is not subscriptable . I tried each of the previously-proposed solutions (each of the solutions described on the page linked above), but each throws an error. I therefore wanted to ask: Is it possible to print the words for a list of synsets with NLTK 3.0? I would be thankful for any advice others can offer

How to get synonyms from nltk WordNet Python

孤者浪人 提交于 2019-11-27 04:22:59
WordNet is great, but I'm having a hard time getting synonyms in nltk. If you search similar to for the word 'small' like here , it shows all of the synonyms. Basically I just need to know the following: wn.synsets('word')[i].option() Where option can be hypernyms and antonyms, but what is the option for getting synonyms? Francis Bond If you want the synonyms in the synset (aka the lemmas that make up the set), you can get them with lemma_names() : >>> for ss in wn.synsets('small'): >>> print(ss.name(), ss.lemma_names()) small.n.01 ['small'] small.n.02 ['small'] small.a.01 ['small', 'little']

Resource 'corpora/wordnet' not found on Heroku

狂风中的少年 提交于 2019-11-27 01:39:35
问题 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

Python: Semantic similarity score for Strings [duplicate]

人走茶凉 提交于 2019-11-27 00:00:34
问题 This question already has an answer here: How to compute the similarity between two text documents? 9 answers Are there any libraries for computing semantic similarity scores for a pair of sentences ? I'm aware of WordNet's semantic database, and how I can generate the score for 2 words, but I'm looking for libraries that do all pre-processing tasks like port-stemming, stop word removal, etc, on whole sentences and outputs a score for how related the two sentences are. I found a work in

Wordnet Similarity in Java: JAWS, JWNL or Java WN::Similarity?

别等时光非礼了梦想. 提交于 2019-11-26 20:29:02
问题 I need to use Wordnet in a java-based app. I want to: search synsets find similarity/relatedness between synsets My app uses RDF graphs and I know there are SPARQL endpoints with Wordnet, but I guess it's better to have a local copy of the dataset, as it's not too big. I've found the following jars: General library - JAWS http://lyle.smu.edu/~tspell/jaws/index.html General library - JWNL http://sourceforge.net/projects/jwordnet Similarity library (Perl) - Wordnet::similarity http://wn

Finding Proper Nouns using NLTK WordNet

拜拜、爱过 提交于 2019-11-26 18:02:06
问题 Is there any way to find proper nouns using NLTK WordNet?Ie., Can i tag Possessive nouns using nltk Wordnet ? 回答1: I don't think you need WordNet to find proper nouns, I suggest using the Part-Of-Speech tagger pos_tag . To find Proper Nouns, look for the NNP tag: from nltk.tag import pos_tag sentence = "Michael Jackson likes to eat at McDonalds" tagged_sent = pos_tag(sentence.split()) # [('Michael', 'NNP'), ('Jackson', 'NNP'), ('likes', 'VBZ'), ('to', 'TO'), ('eat', 'VB'), ('at', 'IN'), (

How to get all the hyponyms of a word/synset in python nltk and wordnet?

隐身守侯 提交于 2019-11-26 16:45:45
问题 I have a list of all the nouns in wordnet now i want to leave only words which are vehicles and remove the rest. How do i do it? Below is the pseudo-code i want to make but i do not know how to make it work for word in wordlist: if not "vehicle" in wn.synsets(word): wordlist.remove(word) 回答1: from nltk.corpus import wordnet as wn vehicle = wn.synset('vehicle.n.01') typesOfVehicles = list(set([w for s in vehicle.closure(lambda s:s.hyponyms()) for w in s.lemma_names()])) This will give you all