(self)
| 310 | return scores |
| 311 | |
| 312 | def test_default_suffix_rules(self): |
| 313 | # Assert part-of-speech tag for unknown tokens. |
| 314 | for a, b in ( |
| 315 | (["eating", "NN"], ["eating", "VBG"]), |
| 316 | (["tigers", "NN"], ["tigers", "NNS"]), |
| 317 | (["really", "NN"], ["really", "RB"]), |
| 318 | (["foolish", "NN"], ["foolish", "JJ"])): |
| 319 | self.assertEqual(text._suffix_rules(a), b) |
| 320 | # Test with words in WordNet that are not in Brill's lexicon. |
| 321 | # Given are the scores for detection of nouns, verbs, adjectives and adverbs. |
| 322 | # The baseline should increase (not decrease) when the algorithm is modified. |
| 323 | v = self._test_morphological_rules(function=text._suffix_rules) |
| 324 | self.assertTrue(v[0] > 0.91) # NN |
| 325 | self.assertTrue(v[1] > 0.23) # VB |
| 326 | self.assertTrue(v[2] > 0.38) # JJ |
| 327 | self.assertTrue(v[3] > 0.60) # RB |
| 328 | print "pattern.text._suffix_rules()" |
| 329 | |
| 330 | def test_apply_morphological_rules(self): |
| 331 | # Assert part-of-speech tag for unknown tokens (Brill's lexical rules). |
nothing calls this directly
no test coverage detected