Package nltk :: Package wordnet :: Module lexname
[hide private]
[frames] | no frames]

Source Code for Module nltk.wordnet.lexname

 1  # Natural Language Toolkit: Wordnet Interface 
 2  # 
 3  # Copyright (C) 2001-2008 NLTK Project 
 4  # Author: Oliver Steele <[email protected]> 
 5  #         David Ormiston Smith <[email protected]>> 
 6  #         Steven Bird <[email protected]> 
 7  # URL: <http://nltk.org> 
 8  # For license information, see LICENSE.TXT 
 9   
10  from util import * 
11   
12  # Lexname class 
13   
14 -class Lexname(object):
15 dict = {} 16 lexnames = [] 17
18 - def __init__(self, name, category):
19 self.name = name 20 self.category = category 21 self.id = len(Lexname.dict) 22 Lexname.dict[name] = self 23 Lexname.lexnames.append(self)
24
25 - def __str__(self):
26 return self.name
27 28 __repr__ = __str__
29 30 # Create Lexname objects, originally sourced from the lexnames file available 31 # as a patch from the Pywordnet sourceforge site. This list may be updated by 32 # the creators of Wordnet at any time. 33 # It must remain in the given order: 34 35 Lexname("adj.all", ADJECTIVE) 36 Lexname("adj.pert", ADJECTIVE) 37 Lexname("adv.all", ADVERB) 38 Lexname("noun.Tops", NOUN) 39 Lexname("noun.act", NOUN) 40 Lexname("noun.animal", NOUN) 41 Lexname("noun.artifcact", NOUN) 42 Lexname("noun.attribute", NOUN) 43 Lexname("noun.body", NOUN) 44 Lexname("noun.cognition", NOUN) 45 Lexname("noun.communication", NOUN) 46 Lexname("noun.event", NOUN) 47 Lexname("noun.feeling", NOUN) 48 Lexname("noun.food", NOUN) 49 Lexname("noun.group", NOUN) 50 Lexname("noun.location", NOUN) 51 Lexname("noun.motive", NOUN) 52 Lexname("noun.object", NOUN) 53 Lexname("noun.person", NOUN) 54 Lexname("noun.phenomenon", NOUN) 55 Lexname("noun.plant", NOUN) 56 Lexname("noun.possession", NOUN) 57 Lexname("noun.process", NOUN) 58 Lexname("noun.quantity", NOUN) 59 Lexname("noun.relation", NOUN) 60 Lexname("noun.shape", NOUN) 61 Lexname("noun.state", NOUN) 62 Lexname("noun.substance", NOUN) 63 Lexname("noun.time", NOUN) 64 Lexname("verb.body", VERB) 65 Lexname("verb.change", VERB) 66 Lexname("verb.cognition", VERB) 67 Lexname("verb.communication", VERB) 68 Lexname("verb.competition", VERB) 69 Lexname("verb.consumption", VERB) 70 Lexname("verb.contact", VERB) 71 Lexname("verb.creation", VERB) 72 Lexname("verb.emotion", VERB) 73 Lexname("verb.motion", VERB) 74 Lexname("verb.perception", VERB) 75 Lexname("verb.possession", VERB) 76 Lexname("verb.social", VERB) 77 Lexname("verb.stative", VERB) 78 Lexname("verb.weather", VERB) 79 Lexname("adj.ppl", ADJECTIVE) 80