本文整理汇总了Python中nltk.corpus.reader.wordnet.NOUN属性的典型用法代码示例。如果您正苦于以下问题:Python wordnet.NOUN属性的具体用法?Python wordnet.NOUN怎么用?Python wordnet.NOUN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类nltk.corpus.reader.wordnet
的用法示例。
在下文中一共展示了wordnet.NOUN属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: lemmatize
# 需要导入模块: from nltk.corpus.reader import wordnet [as 别名]
# 或者: from nltk.corpus.reader.wordnet import NOUN [as 别名]
def lemmatize(self, word, pos=NOUN):
lemmas = wordnet._morphy(word, pos)
return min(lemmas, key=len) if lemmas else word
示例2: testSysnetWordDissect
# 需要导入模块: from nltk.corpus.reader import wordnet [as 别名]
# 或者: from nltk.corpus.reader.wordnet import NOUN [as 别名]
def testSysnetWordDissect(self):
test_string = 'cat.n.1'
test_subject = ProcessedWord(test_string)
self.failUnless(test_subject.raw_word() == "cat")
self.failUnless(test_subject.raw_part_of_speech() == NOUN)
self.failUnless(test_subject.word_index() == 1)
self.assertEqual(test_subject.word(), 'cat')
self.failUnless(test_subject.part_of_speech() == "noun")
self.failUnless(test_subject.word_index() == 1)
示例3: testDetectsAllPartsOfSpeech
# 需要导入模块: from nltk.corpus.reader import wordnet [as 别名]
# 或者: from nltk.corpus.reader.wordnet import NOUN [as 别名]
def testDetectsAllPartsOfSpeech(self):
test_noun = ProcessedWord('noun.'+NOUN+'.1')
test_adverb = ProcessedWord('adverb.' + ADV + '.1')
test_adjective = ProcessedWord('adjective.' + ADJ + '.1')
test_adjective_satellite = ProcessedWord('adjective.' + ADJ_SAT + '.1')
test_verb = ProcessedWord('verb.' + VERB + '.1')
self.assertEqual('noun', test_noun.part_of_speech())
self.assertEqual('adverb', test_adverb.part_of_speech())
self.assertEqual('adjective', test_adjective.part_of_speech())
self.assertEqual('adjective', test_adjective_satellite.part_of_speech())
self.assertEqual('verb', test_verb.part_of_speech())
示例4: testHumanizesDashedAndAccentedWords
# 需要导入模块: from nltk.corpus.reader import wordnet [as 别名]
# 或者: from nltk.corpus.reader.wordnet import NOUN [as 别名]
def testHumanizesDashedAndAccentedWords(self):
test_complex = ProcessedWord('turnip_jack-o\'-lantern.'+NOUN+'.1')
self.assertEqual('turnip jack-o\'-lantern', test_complex.word())