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

Method append

pattern/text/search.py:289–298  ·  view source on GitHub ↗

Appends the given term to the taxonomy and tags it as the given type. Optionally, a disambiguation value can be supplied. For example: taxonomy.append("many", "quantity", "50-200")

(self, term, type=None, value=None)

Source from the content-addressed store, hash-verified

287 return False
288
289 def append(self, term, type=None, value=None):
290 """ Appends the given term to the taxonomy and tags it as the given type.
291 Optionally, a disambiguation value can be supplied.
292 For example: taxonomy.append("many", "quantity", "50-200")
293 """
294 term = self._normalize(term)
295 type = self._normalize(type)
296 self.setdefault(term, (odict(), odict()))[0].push((type, True))
297 self.setdefault(type, (odict(), odict()))[1].push((term, True))
298 self._values[term] = value
299
300 def classify(self, term, **kwargs):
301 """ Returns the (most recently added) semantic type for the given term ("many" => "quantity").

Callers 14

test_taxonomyMethod · 0.95
test_fromstringMethod · 0.95
test_matchMethod · 0.95
test_matchMethod · 0.95
__setitem__Method · 0.45
_appendMethod · 0.45
__repr__Method · 0.45
_ungroupMethod · 0.45
fromstringMethod · 0.45
searchMethod · 0.45
matchMethod · 0.45
__init__Method · 0.45

Calls 4

_normalizeMethod · 0.95
odictClass · 0.85
pushMethod · 0.45
setdefaultMethod · 0.45

Tested by 4

test_taxonomyMethod · 0.76
test_fromstringMethod · 0.76
test_matchMethod · 0.76
test_matchMethod · 0.76