TheFuzz v0.5.0 TheFuzz.Similarity.NGram View Source

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

Link to this section 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

Link to this section Functions

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
Link to this function

compare(a, b, ngram_size) View Source

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