MCPcopy Index your code
hub / github.com/clips/pattern / test_classifier

Method test_classifier

test/test_search.py:116–125  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

114 print "pattern.search.Taxonomy"
115
116 def test_classifier(self):
117 # Assert taxonomy classifier + keyword arguments.
118 c1 = search.Classifier(parents=lambda word, chunk=None: word.endswith("ness") and ["quality"] or [])
119 c2 = search.Classifier(parents=lambda word, chunk=None: chunk=="VP" and ["action"] or [])
120 t = search.Taxonomy()
121 t.classifiers.append(c1)
122 t.classifiers.append(c2)
123 self.assertEqual(t.classify("fuzziness"), "quality")
124 self.assertEqual(t.classify("run", chunk="VP"), "action")
125 print "pattern.search.Classifier"
126
127 def test_wordnet_classifier(self):
128 # Assert WordNet classifier parents & children.

Callers

nothing calls this directly

Calls 2

classifyMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected