TheFuzz.Similarity.Jaccard (TheFuzz v0.6.0)

View Source

This module contains functions to calculate the Jaccard similarity coefficient between two given strings

Summary

Functions

Calculates the Jaccard similarity coefficient between two given strings with a default ngram size of 2

Calculates the Jaccard similarity coefficient between two given strings with the specified ngram size

Functions

compare(a, b)

Calculates the Jaccard similarity coefficient between two given strings with a default ngram size of 2

Examples

iex> TheFuzz.Similarity.Jaccard.compare("contact", "context")
0.3333333333333333
iex> TheFuzz.Similarity.Jaccard.compare("ht", "hththt")
0.2

compare(a, b, n)

Calculates the Jaccard similarity coefficient between two given strings with the specified ngram size

Examples

iex> TheFuzz.Similarity.Jaccard.compare("contact", "context", 3)
0.25
iex> TheFuzz.Similarity.Jaccard.compare("contact", "context", 1)
0.5555555555555556