How to use the textdistance.algorithms.token_based.Sorensen function in textdistance

To help you get started, we’ve selected a few textdistance examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github life4 / textdistance / textdistance / algorithms / token_based.py View on Github external
def __call__(self, *sequences):
        sequences = self._get_counters(*sequences)              # sets
        intersection = self._intersect_counters(*sequences)     # set
        sequences = (self._count_counters(sequence - intersection) for sequence in sequences)
        # ^ ints
        return max(sequences)


bag = Bag()
cosine = Cosine()
dice = Sorensen()
jaccard = Jaccard()
monge_elkan = MongeElkan()
overlap = Overlap()
sorensen = Sorensen()
sorensen_dice = Sorensen()
# sorensen_dice = Tversky(ks=[.5, .5])
tanimoto = Tanimoto()
tversky = Tversky()
github life4 / textdistance / textdistance / algorithms / token_based.py View on Github external
"""
    def __call__(self, *sequences):
        sequences = self._get_counters(*sequences)              # sets
        intersection = self._intersect_counters(*sequences)     # set
        sequences = (self._count_counters(sequence - intersection) for sequence in sequences)
        # ^ ints
        return max(sequences)


bag = Bag()
cosine = Cosine()
dice = Sorensen()
jaccard = Jaccard()
monge_elkan = MongeElkan()
overlap = Overlap()
sorensen = Sorensen()
sorensen_dice = Sorensen()
# sorensen_dice = Tversky(ks=[.5, .5])
tanimoto = Tanimoto()
tversky = Tversky()
github life4 / textdistance / textdistance / algorithms / token_based.py View on Github external
class Bag(_Base):
    """Bag distance
    https://github.com/Yomguithereal/talisman/blob/master/src/metrics/distance/bag.js
    """
    def __call__(self, *sequences):
        sequences = self._get_counters(*sequences)              # sets
        intersection = self._intersect_counters(*sequences)     # set
        sequences = (self._count_counters(sequence - intersection) for sequence in sequences)
        # ^ ints
        return max(sequences)


bag = Bag()
cosine = Cosine()
dice = Sorensen()
jaccard = Jaccard()
monge_elkan = MongeElkan()
overlap = Overlap()
sorensen = Sorensen()
sorensen_dice = Sorensen()
# sorensen_dice = Tversky(ks=[.5, .5])
tanimoto = Tanimoto()
tversky = Tversky()