Skip to content

Commit f3823a1

Browse files
committed
Readme: modified QGram explanation
1 parent 34e7a50 commit f3823a1

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public class MyApp {
182182
A-gram similarity and distance, as defined by Ukkonen in "Approximate string-matching with q-grams and maximal matches"
183183
http://www.sciencedirect.com/science/article/pii/0304397592901434
184184

185-
The distance between two strings is defined as the L1 norm of the difference of their profiles (the number of occurences of each n-gram). Q-gram distance is a lower bound on Levenshtein distance, but can be computed in O(|A| + |B|), where Levenshtein requires O(|A|.|B|)
185+
The distance between two strings is defined as the L1 norm of the difference of their profiles (the number of occurences of each n-gram): SUM( |Ai - Bi| ). Absolute Q-gram distance is a lower bound on Levenshtein distance, but can be computed in O(|A| + |B|), where Levenshtein requires O(|A|.|B|)
186186

187187
```java
188188
import info.debatty.java.stringsimilarity.*;
@@ -195,9 +195,6 @@ public class MyApp {
195195
// AB BC CD CE
196196
// 1 1 1 0
197197
// 1 1 0 1
198-
// Total: 2
199-
System.out.println(dig.absoluteDistance("ABCD", "ABCE"));
200-
201198
// 2 / (3 + 3) = 0.33333
202199
System.out.println(dig.distance("ABCD", "ABCE"));
203200
}

0 commit comments

Comments
 (0)