E
Eli Bendersky
Hi all,
In my application I need an "edit_distance" method that computes the
Edit Distance (Also called Levenshtein Distance, see this:
http://en.wikipedia.org/wiki/Levenshtein_distance) between two
strings. I wonder where is the right place to put this method. I have
a "utils" Ruby file with various extensions to classes and modules
that make my life easier. So there are two options:
1) Have a global (Kernel) method named "edit_distance" that accepts
two strings
2) Add a "edit_distance_from" method to the String class that accepts
the "other" string
Which approach is better, in your opinion ?
P.S: There are lots of Edit Distance implementations in Ruby online.
For example:
http://db.cs.helsinki.fi/~jaarnial/mt/archives/000074.html
http://ruby.brian-schroeder.de/editierdistanz/
In my application I need an "edit_distance" method that computes the
Edit Distance (Also called Levenshtein Distance, see this:
http://en.wikipedia.org/wiki/Levenshtein_distance) between two
strings. I wonder where is the right place to put this method. I have
a "utils" Ruby file with various extensions to classes and modules
that make my life easier. So there are two options:
1) Have a global (Kernel) method named "edit_distance" that accepts
two strings
2) Add a "edit_distance_from" method to the String class that accepts
the "other" string
Which approach is better, in your opinion ?
P.S: There are lots of Edit Distance implementations in Ruby online.
For example:
http://db.cs.helsinki.fi/~jaarnial/mt/archives/000074.html
http://ruby.brian-schroeder.de/editierdistanz/