TheFuzz.Similarity.NGram (TheFuzz v0.6.0)

View Source

This module contains functions to calculate the ngram distance between two given strings based on this paper

Summary

Functions

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

Calculates the ngram similarity between two given strings with a specified ngram size

Functions

compare(a, b)

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

Examples

iex> TheFuzz.Similarity.NGram.compare("context", "contact")
0.5
iex> TheFuzz.Similarity.NGram.compare("ht", "nacht")
0.25

compare(a, b, ngram_size)

Calculates the ngram similarity between two given strings with a specified ngram size

Examples

iex> TheFuzz.Similarity.NGram.compare("night", "naght", 3)
0.3333333333333333
iex> TheFuzz.Similarity.NGram.compare("context", "contact", 1)
0.7142857142857143