You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[Sorensen-Dice coefficient](#sorensen-dice-coefficient)|similarity<br>distance | Yes | No | Set | O(m+n) ||
62
+
|[Ratcliff-Obershelp](#ratcliff-obershelp)|similarity<br>distance | Yes | No || ? ||
61
63
62
64
[1] In this library, Levenshtein edit distance, LCS distance and their sibblings are computed using the **dynamic programming** method, which has a cost O(m.n). For Levenshtein distance, the algorithm is sometimes called **Wagner-Fischer algorithm** ("The string-to-string correction problem", 1974). The original algorithm uses a matrix of size m x n to store the Levenshtein distance between string prefixes.
63
65
@@ -464,6 +466,37 @@ public class MyApp {
464
466
}
465
467
}
466
468
```
469
+
## Ratcliff-Obershelp
470
+
Gestalt Pattern Matching, also Ratcliff/Obershelp Pattern Recognition, is a string-matching algorithm for determining the similarity of two strings. It was developed in 1983 by John W. Ratcliff and John A. Obershelp and published in the Dr. Dobb's Journal in July 1988
471
+
472
+
Ratcliff/Obershelp computes the similarity between 2 strings, and the returned value lies in the interval [0.0, 1.0].
473
+
474
+
The distance is computed as 1 - Ratcliff/Obershelp similarity.
475
+
476
+
```java
477
+
importinfo.debatty.java.stringsimilarity.*;
478
+
479
+
publicclassMyApp {
480
+
481
+
482
+
publicstaticvoidmain(String[] args) {
483
+
RatcliffObershelp ro =newRatcliffObershelp();
484
+
485
+
// substitution of s and t
486
+
System.out.println(ro.similarity("My string", "My tsring"));
487
+
488
+
// substitution of s and n
489
+
System.out.println(ro.similarity("My string", "My ntrisg"));
490
+
}
491
+
}
492
+
```
493
+
494
+
will produce:
495
+
496
+
```
497
+
0.8888888888888888
498
+
0.7777777777777778
499
+
```
467
500
468
501
## Users
469
502
*[StringSimilarity.NET](https://github.com/feature23/StringSimilarity.NET) a .NET port of java-string-similarity
0 commit comments