require 'inline'
+# Class to calculate the Levenshtein distance between two
+# given strings.
+# http://en.wikipedia.org/wiki/Levenshtein_distance
class Levenshtein
BYTES_IN_INT = 4
l.distance_C(s, t, s.length, t.length, v0, v1)
end
- def initialize
- end
-
# >>>>>>>>>>>>>>> RubyInline C code <<<<<<<<<<<<<<<
inline do |builder|
builder.c %{
VALUE distance_C(
- VALUE _s,
- VALUE _t,
- VALUE _s_len,
- VALUE _t_len,
- VALUE _v0,
- VALUE _v1
+ VALUE _s, // string
+ VALUE _t, // string
+ VALUE _s_len, // string length
+ VALUE _t_len, // string length
+ VALUE _v0, // score vector
+ VALUE _v1 // score vector
)
{
char *s = (char *) StringValuePtr(_s);