wordnet

How to get the WordNet synset given an offset ID?

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: 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_pos_and_offset ( 'n'

How to get all the meanings of a word using python NLTK?

跟風遠走 提交于 2019-12-02 18:28:13
问题 I want to use all meanings of a particular word in an input query. For example: Suppose my input query is: "Dog is barking at tree" Here I want to get all meanings of the word TREE and BARK in the following format: tree#n#01,tree#n#02... and so on. bark#n#01,bark#n#02... and so on I am using POS tagging to extract noun,verb,adjective and adverb synset accordingly. If bark is used as verb (as used in our input query) then only the related meanings should be displayed as bark#v#01,bark#v#02...

To find synonyms, definitions and example sentences using WordNet

▼魔方 西西 提交于 2019-12-02 16:00:06
I need to take an input text file with a one word. I then need to find the lemma_names, definition and examples of the synset of the word using wordnet. I have gone through the book : "Python Text Processing with NLTK 2.0 Cookbook" and also "Natural Language Processing using NLTK" to help me in this direction. Though I have understood how this can be done using the terminal, I'm not able to do the same using a text editor. For example, if the input text has the word "flabbergasted", the output needs to be in this fashion: flabbergasted (verb) flabbergast, boggle, bowl over - overcome with

How to find distance between two synset using python nltk in wordnet hierarchy?

不打扰是莪最后的温柔 提交于 2019-12-02 15:04:53
问题 Suppose I have two synsets synset(car.n.01') and synset('bank.n.01') and If I want to find the distance between these two synset in wordnet hierarchy then How can I do it using nltk? I searched on internet but I am getting similarity algorithms like lin,resnik,jcn etc which are not solution for my question. Please help me to solve this problem. 回答1: From this Path similarity, wup_similarity and lch_similarity , all of these should work since they are based on the distance between two synsets

Sentiment Analysis using senti_classifier and NLTK

时间秒杀一切 提交于 2019-12-02 12:59:11
问题 I'm not doing something right -- By the looks of the error i'm getting i think i'm missing some data. I have all the prerequisites intalled for sentiment_classifier (https://pypi.python.org/pypi/sentiment_classifier/0.7) which are nltk, numpy, and sentiwordnet. Here's my code - a quick example from the docs i'm trying to get working. from senti_classifier import senti_classifier sentences = ['The movie was the worst movie', 'It was the worst acting by the actors'] pos_score, neg_score = senti

How to get all the meanings of a word using python NLTK?

不羁的心 提交于 2019-12-02 10:03:15
I want to use all meanings of a particular word in an input query. For example: Suppose my input query is: "Dog is barking at tree" Here I want to get all meanings of the word TREE and BARK in the following format: tree#n#01,tree#n#02... and so on. bark#n#01,bark#n#02... and so on I am using POS tagging to extract noun,verb,adjective and adverb synset accordingly. If bark is used as verb (as used in our input query) then only the related meanings should be displayed as bark#v#01,bark#v#02... Please help me to solve this using Python. I am using Python NLTK module for natural language

How to find distance between two synset using python nltk in wordnet hierarchy?

孤人 提交于 2019-12-02 08:29:33
Suppose I have two synsets synset(car.n.01') and synset('bank.n.01') and If I want to find the distance between these two synset in wordnet hierarchy then How can I do it using nltk? I searched on internet but I am getting similarity algorithms like lin,resnik,jcn etc which are not solution for my question. Please help me to solve this problem. axiom From this Path similarity, wup_similarity and lch_similarity , all of these should work since they are based on the distance between two synsets in the Wordnet hierarchy. dog = wn.synset('dog.n.01') cat = wn.synset('cat.n.01') dog.path_similarity

Wrapping around old C Structures with smart pointers in C++11 and auto-freeing them

允我心安 提交于 2019-12-02 05:07:06
问题 I'm using Word-Net, an old C library developed by Princeton University back in the nineties. The library is written in C, and only reveals the headers but not its actual implementation. The only structure I use is: SynsetPtr And the two functions I call are: findtheinfo_ds traceptrs_ds Both those functions return a SynsetPtr. Howevever, when the SynsetPtr represents a sense list, I have to free it using free_syns Whereas, when the SynsetPtr is used to traverse a linked list (a hierarchical

Wrapping around old C Structures with smart pointers in C++11 and auto-freeing them

荒凉一梦 提交于 2019-12-02 01:36:39
I'm using Word-Net , an old C library developed by Princeton University back in the nineties. The library is written in C, and only reveals the headers but not its actual implementation. The only structure I use is: SynsetPtr And the two functions I call are: findtheinfo_ds traceptrs_ds Both those functions return a SynsetPtr. Howevever, when the SynsetPtr represents a sense list, I have to free it using free_syns Whereas, when the SynsetPtr is used to traverse a linked list (a hierarchical tree), I have to free it using free_synset The Documentation is not really clear when to call which, and

Does the lemmatization mechanism reduce the size of the corpus?

对着背影说爱祢 提交于 2019-12-01 20:34:31
Dear Community Members, During the pre-processing of data, after splitting the raw_data into tokens, I have used the popular WordNet Lemmatizer to generate the stems. I am performing experiments on a dataset that has 18953 tokens. My question is, does the lemmatization process reduce the size of corpus? I am confused, kindly help in this regard. Any help is appreciated! Lemmatization converts each token (aka form ) in the sentence into its lemma form (aka type ): >>> from nltk import word_tokenize >>> from pywsd.utils import lemmatize_sentence >>> text = ['This is a corpus with multiple