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)
| 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"). |