How to use the textdistance.algorithms.token_based.Tanimoto 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
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):
        result = super(Tanimoto, self).__call__(*sequences)
        if result == 0:
            return float('-inf')
        else:
            return log(result, 2)