object
string_distance(Representation)
Representation- String representation. Valid values areatom,codes, andchars.
String distance predicates.
logtalk_load(string_distance(loader))static, context_switching_callsPublic predicates
levenshtein/3
Computes the Levenshtein distance between two strings.
staticlevenshtein(String1,String2,Distance)String1 - First input string.String2 - Second input string.Distance - Minimum number of single-character edits (insertions, deletions, substitutions) to transform String1 into String2.levenshtein(+text,+text,-integer) - onedamerau_levenshtein/3
Computes the Damerau-Levenshtein distance between two strings.
staticdamerau_levenshtein(String1,String2,Distance)String1 - First input string.String2 - Second input string.Distance - Minimum number of edits (insertions, deletions, substitutions, and adjacent transpositions) to transform String1 into String2.damerau_levenshtein(+text,+text,-integer) - onehamming/3
Computes the Hamming distance between two strings of equal length. Fails if the strings differ in length.
statichamming(String1,String2,Distance)String1 - First input string.String2 - Second input string (must have the same length as String1).Distance - Number of positions at which the corresponding characters differ.hamming(+text,+text,-integer) - zero_or_onejaro/3
Computes the Jaro similarity score between two strings.
staticjaro(String1,String2,Similarity)String1 - First input string.String2 - Second input string.Similarity - A value between 0.0 (completely different) and 1.0 (identical), based on matching characters and transpositions.jaro(+text,+text,-float) - onejaro_winkler/3
Computes the Jaro-Winkler similarity score between two strings.
staticjaro_winkler(String1,String2,Similarity)String1 - First input string.String2 - Second input string.Similarity - A value between 0.0 and 1.0. Extends Jaro similarity with a prefix bonus: strings sharing a common prefix are scored higher.jaro_winkler(+text,+text,-float) - oneedit_similarity/3
Computes the edit similarity score between two strings using Levenshtein distance.
staticedit_similarity(String1,String2,Similarity)String1 - First input string.String2 - Second input string.Similarity - A value between 0.0 and 1.0 computed as 1 - (edit distance / max length of the two strings).edit_similarity(+text,+text,-float) - oneedit_similarity/4
Computes the edit similarity score between two strings using the given algorithm.
staticedit_similarity(Algorithm,String1,String2,Similarity)Algorithm - Edit distance algorithm. Valid values are levenshtein, damerau_levenshtein, hamming, and longest_common_subsequence.String1 - First input string.String2 - Second input string.Similarity - A value between 0.0 and 1.0 computed as 1 - (edit distance / max length of the two strings).edit_similarity(+atom,+text,+text,-float) - onelongest_common_subsequence_length/3
Computes the length of the Longest Common Subsequence between two strings.
staticlongest_common_subsequence_length(String1,String2,Length)String1 - First input string.String2 - Second input string.Length - Length of the longest subsequence common to both strings (characters need not be contiguous).longest_common_subsequence_length(+text,+text,-integer) - onelongest_common_subsequence/3
Computes the Longest Common Subsequence itself between two strings.
staticlongest_common_subsequence(String1,String2,Subsequence)String1 - First input string.String2 - Second input string.Subsequence - The longest subsequence common to both strings (characters need not be contiguous). If multiple exist, one is returned nondeterministically.longest_common_subsequence(+text,+text,-atom) - onelongest_common_substring/3
Computes the longest contiguous common substring between two strings.
staticlongest_common_substring(String1,String2,Substring)String1 - First input string.String2 - Second input string.Substring - The longest contiguous substring shared by both strings. If multiple exist, one is returned nondeterministically.longest_common_substring(+text,+text,-atom) - onecosine_similarity/3
Computes the cosine similarity between two token lists.
staticcosine_similarity(Tokens1,Tokens2,Similarity)Tokens1 - First token list (e.g., list of words or character n-grams).Tokens2 - Second token list.Similarity - A value between 0.0 and 1.0 representing the cosine of the angle between the two token vectors.cosine_similarity(+list(text),+list(text),-float) - onejaccard_index/3
Computes the Jaccard index (similarity) between two token lists.
staticjaccard_index(Tokens1,Tokens2,Index)Tokens1 - First token list (e.g., list of words or character n-grams).Tokens2 - Second token list.Index - A value between 0.0 (no overlap) and 1.0 (identical sets), computed as |intersection| / |union|.jaccard_index(+list(text),+list(text),-float) - onesoundex/2
Computes the Soundex phonetic encoding for a string.
staticsoundex(String,Encoding)String - Input string (typically a name).Encoding - A four-character Soundex code representing the phonetic encoding.soundex(+text,-atom) - onesoundex_match/2
Succeeds if two strings share the same Soundex code.
staticsoundex_match(String1,String2)String1 - First input string.String2 - Second input string.soundex_match(+text,+text) - onemetaphone/2
Computes the Metaphone phonetic key for a string.
staticmetaphone(String,Encoding)String - Input string (typically a name).Encoding - The Metaphone phonetic encoding, a more accurate phonetic encoding than Soundex.metaphone(+text,-atom) - onemetaphone_match/2
Succeeds if two strings share the same Metaphone key.
staticmetaphone_match(String1,String2)String1 - First input string.String2 - Second input string.metaphone_match(+text,+text) - onedouble_metaphone/3
Computes the Double Metaphone encoding of a text, returning both primary and alternative encodings.
staticdouble_metaphone(Text,Primary,Alternative)Text - Input string (typically a name).Primary - Primary Double Metaphone encoding.Alternative - Alternative Double Metaphone encoding.double_metaphone(+text,-atom,-atom) - onedouble_metaphone_match/2
Succeeds if the Double Metaphone encodings of two texts match (either primary or alternative encodings).
staticdouble_metaphone_match(String1,String2)String1 - First input string.String2 - Second input string.double_metaphone_match(+text,+text) - zero_or_oneProtected predicates
(no local declarations; see entity ancestors if any)
Private predicates
(no local declarations; see entity ancestors if any)
Operators
(none)