@Immutable public class QGram extends Object implements StringDistance
Constructor and Description |
---|
QGram()
Q-gram similarity and distance.
|
QGram(int k)
Q-gram similarity and distance.
|
Modifier and Type | Method and Description |
---|---|
double |
distance(String s1,
String s2)
The distance between two strings is defined as the L1 norm of the
difference of their profiles (the number of occurence of each k-shingle).
|
int |
getK()
Return k, the length of k-shingles (aka n-grams).
|
Map<String,Integer> |
getProfile(String string)
Compute and return the profile of s, as defined by Ukkonen "Approximate
string-matching with q-grams and maximal matches".
|
public QGram(int k)
k
- public QGram()
public final double distance(String s1, String s2)
distance
in interface StringDistance
s1
- s2
- public int getK()
public final Map<String,Integer> getProfile(String string)
string
- Copyright © 2016. All rights reserved.