(self, wordnet=None)
| 399 | class WordNetClassifier(Classifier): |
| 400 | |
| 401 | def __init__(self, wordnet=None): |
| 402 | if wordnet is None: |
| 403 | try: from en import wordnet |
| 404 | except: |
| 405 | pass |
| 406 | Classifier.__init__(self, self._parents, self._children) |
| 407 | self.wordnet = wordnet |
| 408 | |
| 409 | def _children(self, word, pos="NN"): |
| 410 | try: return [w.senses[0] for w in self.wordnet.synsets(word, pos)[0].hyponyms()] |