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

Method __init__

pattern/vector/__init__.py:616–625  ·  view source on GitHub ↗

A dictionary of (feature, weight)-items of the features (terms, words) in a Document. A vector can be used to compare the document to another document with a distance metric. For example, vectors with 2 features (x, y) can be compared using 2D Euclidean distance.

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

614 id = 1
615
616 def __init__(self, *args, **kwargs):
617 """ A dictionary of (feature, weight)-items of the features (terms, words) in a Document.
618 A vector can be used to compare the document to another document with a distance metric.
619 For example, vectors with 2 features (x, y) can be compared using 2D Euclidean distance.
620 Vectors that represent text documents can be compared using cosine similarity.
621 """
622 self.id = Vector.id; Vector.id+=1 # Unique ID.
623 self.weight = kwargs.pop("weight", TF) # Vector weights based on tf, tf-idf, binary?
624 self._norm = None
625 readonlydict.__init__(self, *args, **kwargs)
626
627 @property
628 def features(self):

Callers

nothing calls this directly

Calls 2

popMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected