module Stemmer
Public Class Methods
stem_word(p1)
click to toggle source
static VALUE stem_word(VALUE self, VALUE arg) { size_t length, i; char *word; struct stemmer z; VALUE str, rv; str = StringValue(arg); word = malloc(RSTRING_LEN(str) + 1); strncpy(word, RSTRING_PTR(str), RSTRING_LEN(str)); word[RSTRING_LEN(str)] = '\0'; length = stem(&z, word, strlen(word)-1); word[length+1] = 0; rv = rb_str_new2(word); free(word); return rv; }