TheFuzz.Similarity.NGram

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

Source

Summary

compare(a, b)

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

compare(a, b, ngram_size)

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
Source
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
Source