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

Class Classifier

pattern/text/search.py:382–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380#--- TAXONOMY CLASSIFIER ---------------------------------------------------------------------------
381
382class Classifier(object):
383
384 def __init__(self, parents=lambda term: [], children=lambda term: [], value=lambda term: None):
385 """ A classifier uses a rule-based approach to enrich the taxonomy, for example:
386 c = Classifier(parents=lambda term: term.endswith("ness") and ["quality"] or [])
387 taxonomy.classifiers.append(c)
388 This tags any word ending in -ness as "quality".
389 This is much shorter than manually adding "roughness", "sharpness", ...
390 Other examples of useful classifiers: calling en.wordnet.Synset.hyponyms() or en.number().
391 """
392 self.parents = parents
393 self.children = children
394 self.value = value
395
396# Classifier(parents=lambda word: word.endswith("ness") and ["quality"] or [])
397# Classifier(parents=lambda word, chunk=None: chunk=="VP" and [ACTION] or [])

Callers 2

04-taxonomy.pyFile · 0.90
_test_classifierMethod · 0.50

Calls

no outgoing calls

Tested by 1

_test_classifierMethod · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…