Thursday, March 27, 2014

[My projects] "jTextBrew" TextBrew implementation in JAVA


Thanks to Chris Brew we have this awesome customizable edit distance algorithm called TextBrew.
It can be used for fuzzy string matching and can be used even for shorthands and abbreviation matching. By changing a few parameters you can use it particularly for your purpose.
You can read more about TextBrew algorithm here http://www.ling.ohio-state.edu/~cbrew/795M/string-distance.html.

What I have done is to create a JAVA implementation of the modified https://github.com/relaynetwork/fuzzy-string-matching project, for my own purpose in one of my other project.
You can find jTextBrew at https://github.com/puneetsl/jtextbrew.

A few examples of the use of this library:

  1. TextBrew.compare("BRYN MAWR PIZZA II", "BR MA PI II");
    would return 52% match
  2. You can change costs using the following function:
    TextBrew.setCosts(Match, Insert, Delete, Substitute);

Why is it handy?
When combined with other fuzzy string matching algorithms taking weighted average can give really good results. I am currently using it for auto spell correction, combining it with n-gram. And this is giving really good result.

Don't forget to star this project on GitHub in case you use it. ;)