textSim
It is implemented in the library, textSim.
computes TF-IDF based cosine similarity between two strings |
|
computes cosine similarity between two strings |
tfidfCosineSimilarityAdvance
Computes TF-IDF based cosine similarity between two strings.
tfidfCosineSimilarityAdvance(Text1, Text2, <case_sensitivity>)
Where:
-
Text1is the first string to be compared. -
Text2is the second string to be compared. -
<case_sensitivity>can becaseSensitiveorcaseInsensitive.
Example
@library("textSim:", "textSim").
input("hello world").
result(X) :- input(Y), X = textSim:tfidfCosineSimilarityAdvance(Y, "hello", "caseinsensitive").
@output("result").
Expected results
result(0.707)
cosineSimilarityAdvance
Computes cosine similarity between two strings.
cosineSimilarityAdvance(Text1, Text2, <case_sensitivity>)
Where:
-
Text1is the first string to be compared. -
Text2is the second string to be compared. -
<case_sensitivity>can becaseSensitiveorcaseInsensitive.
Example
@library("textSim:", "textSim").
input("hello world").
result(X) :- input(Y), X = textSim:cosineSimilarityAdvance(Y, "hello", "caseinsensitive").
@output("result").
Expected results
result(0.816)