Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fe887e2

Browse files
authored
Update README.md
1 parent 31f95b8 commit fe887e2

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

‎README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ A library implementing different string similarity and distance measures. A doze
2424
* [Sorensen-Dice coefficient](#shingle-n-gram-based-algorithms)
2525
* [Experimental](#experimental)
2626
* [SIFT4](#sift4)
27+
* [Ratcliff-Obershelp](#ratcliff-obershelp)
2728
* [Users](#users)
2829

2930

@@ -58,6 +59,7 @@ The main characteristics of each implemented algorithm are presented below. The
5859
| [Cosine similarity](#cosine-similarity) |similarity<br>distance | Yes | No | Profile | O(m+n) | |
5960
| [Jaccard index](#jaccard-index) |similarity<br>distance | Yes | Yes | Set | O(m+n) | |
6061
| [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 | | ? | |
6163

6264
[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.
6365

@@ -464,6 +466,37 @@ public class MyApp {
464466
}
465467
}
466468
```
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+
import info.debatty.java.stringsimilarity.*;
478+
479+
public class MyApp {
480+
481+
482+
public static void main(String[] args) {
483+
RatcliffObershelp ro = new RatcliffObershelp();
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+
```
467500

468501
## Users
469502
* [StringSimilarity.NET](https://github.com/feature23/StringSimilarity.NET) a .NET port of java-string-similarity

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /