Entries from 2013-04-22 to 1 day

O'Reilly: Chapter 1 Exercise 1 - 16

Read through Chapter 1 of the O'Reilly's textbook. Here quickly go through the exercise. These are just my results and might not be the best answers of the questions.1. >>> 12 / (4 + 1) 2 >>> from __future__ import division >>> 12 / (4 + 1…

Synonyms and Antonyms

To find synonyms of a word, lemma can be used. This example is to find synonyms of "cookbook". >>> syn = wordnet.synsets('cookbook')[0] >>> lemmas = syn.lemmas >>> len(lemmas) 2 >>> lemmas [Lemma('cookbook.n.01.cookbook'), Lemma('cookbook.…

WordNet and Hypernyms

WordNet is a lexical database, a kind of dictionary.Japanese: http://ja.wikipedia.org/wiki/WordNet English: http://en.wikipedia.org/wiki/WordNetNLTK has a simple interface to WordNet. Synset is groups of similar meaning words. A word belon…

Stopwords

Stopwords are common words that generally do not contribute to the meaning of sentences. As usual, import nltk.book. >>> import nltk >>> from nltk.book import * *** Introductory Examples for the NLTK Book *** Loading text1, ..., text9 and …