@Immutable public class Cosine extends Object implements NormalizedStringDistance, NormalizedStringSimilarity
Constructor and Description |
---|
Cosine()
Implements Cosine Similarity between strings.
|
Cosine(int k)
Implements Cosine Similarity between strings.
|
Modifier and Type | Method and Description |
---|---|
double |
distance(String s1,
String s2)
Return 1.0 - similarity.
|
int |
getK()
Return k, the length of k-shingles (aka n-grams).
|
double |
similarity(String s1,
String s2)
Compute the cosine similarity between strings.
|
public Cosine(int k)
k
- public Cosine()
public final double similarity(String s1, String s2)
similarity
in interface StringSimilarity
s1
- s2
- public final double distance(String s1, String s2)
distance
in interface StringDistance
s1
- s2
- public int getK()
Copyright © 2016. All rights reserved.