View Source Akin.Jaccard (Akin v0.2.0)
Functions to calculate the Jaccard similarity between two strings
Summary
Functions
Calculates the Jaccard similarity coefficient between two given strings with the specified ngram size
Functions
@spec compare( %Akin.Corpus{ list: term(), original: term(), set: term(), stems: term(), string: term() }, %Akin.Corpus{ list: term(), original: term(), set: term(), stems: term(), string: term() }, Keyword.t() ) :: float()
Calculates the Jaccard similarity coefficient between two given strings with the specified ngram size
Examples
iex> Akin.Jaccard.compare(%Akin.Corpus{string: "contact"}, %Akin.Corpus{string: "context"}, [ngram_size: 3]) 0.25 iex> Akin.Jaccard.compare(%Akin.Corpus{string: "contact"}, %Akin.Corpus{string: "context"}, [ngram_size: 1]) 0.5555555555555556