From d4ff3adc5a6d3431fdece3fcdae02239ad742f04 Mon Sep 17 00:00:00 2001 From: wltsmrz Date: Mon, 16 Nov 2020 11:22:10 +0000 Subject: [PATCH] Cleanup --- src/stemmer.carp | 12 ++++++------ src/string_add.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/stemmer.carp b/src/stemmer.carp index 192d273..499b8de 100644 --- a/src/stemmer.carp +++ b/src/stemmer.carp @@ -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))) @@ -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) @@ -231,7 +231,7 @@ (step-4) (step-5a) (step-5b) - )))) + ))) (defn stem-cstr [x] (cstr &(stem &(String.from-cstr x)))) diff --git a/src/string_add.h b/src/string_add.h index 7c667c2..69eeac6 100644 --- a/src/string_add.h +++ b/src/string_add.h @@ -1,3 +1,4 @@ + size_t String_utf8len_(const String* p) { return utf8len(*p); }