wordnet

Resource 'corpora/wordnet' not found on Heroku

…衆ロ難τιáo~ 提交于 2019-11-28 06:53:12
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. follyroof I just had this same problem. What ended up working for me is creating an 'nltk

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

泪湿孤枕 提交于 2019-11-28 04:25:23
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. 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 = wordnet.synsets('stack') for s in syns: for l in s.lemmas(): print l.name + " " + str(l.count()) Result:

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

倖福魔咒の 提交于 2019-11-28 03:24:37
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 (whose own meronym relationships shows ‘square’ & 'diagonal') Bookcase : shelve Weighting of terms will

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

僤鯓⒐⒋嵵緔 提交于 2019-11-27 20:53:38
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-similarity.sourceforge.net/ Java version of Wordnet::similarity http://www.cogs.susx.ac.uk/users/drh21/ (beta)

How to get the WordNet synset given an offset ID?

白昼怎懂夜的黑 提交于 2019-11-27 20:34:06
问题 I have a WordNet synset offset (for example id="n#05576222" ). Given this offset, how can I get the synset using Python? 回答1: As of NLTK 3.2.3, there's a public method for doing this: wordnet.synset_from_pos_and_offset(pos, offset) In earlier versions you can use: wordnet.synset_from_pos_and_offset(pos, offset) This returns a synset based on it's POS and offest ID. I think this method is only available in NLTK 3.0 but I'm not sure. Example: from nltk.corpus import wordnet as wn wn.synset_from

Python: Semantic similarity score for Strings [duplicate]

ε祈祈猫儿з 提交于 2019-11-27 17:20:24
This question already has an answer here: How to compute the similarity between two text documents? 8 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 progress that's written using the .NET framework that computes the score using an array of pre-processing

Python NLTK Lemmatization of the word 'further' with wordnet

百般思念 提交于 2019-11-27 15:52:29
I'm working on a lemmatizer using python, NLTK and the WordNetLemmatizer. Here is a random text that output what I was expecting from nltk.stem import WordNetLemmatizer from nltk.corpus import wordnet lem = WordNetLemmatizer() lem.lemmatize('worse', pos=wordnet.ADJ) // here, we are specifying that 'worse' is an adjective Output: 'bad' lem.lemmatize('worse', pos=wordnet.ADV) // here, we are specifying that 'worse' is an adverb Output: 'worse' Well, everything here is fine. The behaviour is the same with other adjectives like 'better' (for an irregular form) or 'older' (note that the same test

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

风流意气都作罢 提交于 2019-11-27 14:29:18
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) Jared 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 the unique words from every synset that is a hyponym of the noun "vehicle" (1st sense). def get

Finding Proper Nouns using NLTK WordNet

浪尽此生 提交于 2019-11-27 11:29:21
Is there any way to find proper nouns using NLTK WordNet?Ie., Can i tag Possessive nouns using nltk Wordnet ? 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'), ('McDonalds', 'NNP')] propernouns = [word for word,pos in tagged_sent if pos == 'NNP'] # ['Michael','Jackson',

Using NLTK and WordNet; how do I convert simple tense verb into its present, past or past participle form?

隐身守侯 提交于 2019-11-27 06:58:55
Using NLTK and WordNet , how do I convert simple tense verb into its present, past or past participle form? For example: I want to write a function which would give me verb in expected form as follows. v = 'go' present = present_tense(v) print present # prints "going" past = past_tense(v) print past # prints "went" I think what you're looking for is the NodeBox::Linguistics library. It does exactly that: print en.verb.present("gave") >>> give Gunjan With the help of NLTK this can also be done. It can give the base form of the verb. But not the exact tense, but it still can be useful. Try the