Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wltsmrz committed Nov 16, 2020
1 parent b22cf9c commit d4ff3ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/stemmer.carp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

(defmodule PorterStemmer
(relative-include "string_add.h")
(register to-lower (Fn [&String] String) "String_to_lower_")
(register utf8-length (Fn [&String] Int) "String_utf8len_")
(register to-lower (Fn [&String] String) "String_to_lower_")

(defn trim-from [x j]
(String.slice x 0 (+ (utf8-length x) j)))
Expand Down Expand Up @@ -219,10 +219,10 @@
x))

(defn stem [x]
(let [xx (to-lower x)]
(cond (< (String.length &xx) 3)
xx
(=> xx
(cond (< (String.length x) 3)
@x
(=> x
(to-lower)
(step-1a)
(step-1b)
(step-1c)
Expand All @@ -231,7 +231,7 @@
(step-4)
(step-5a)
(step-5b)
))))
)))

(defn stem-cstr [x]
(cstr &(stem &(String.from-cstr x))))
Expand Down
1 change: 1 addition & 0 deletions src/string_add.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

size_t String_utf8len_(const String* p) {
return utf8len(*p);
}
Expand Down

0 comments on commit d4ff3ad

Please sign in to comment.