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

Method classify

pattern/vector/__init__.py:1752–1759  ·  view source on GitHub ↗

Returns the type with the highest probability for the given document. Returns a dict of (class, probability)-items if discrete=False.

(self, document, discrete=True)

Source from the content-addressed store, hash-verified

1750 self._classes[type] = self._classes.get(type, 0) + 1
1751
1752 def classify(self, document, discrete=True):
1753 """ Returns the type with the highest probability for the given document.
1754 Returns a dict of (class, probability)-items if discrete=False.
1755 """
1756 # This method must be implemented in subclass.
1757 if not discrete:
1758 return defaultdict(float)
1759 return self.baseline
1760
1761 def _vector(self, document, type=None):
1762 """ Returns a (type, Vector)-tuple for the given document.

Callers 1

_test_classifierMethod · 0.95

Calls

no outgoing calls

Tested by 1

_test_classifierMethod · 0.76