diff --git a/contrib/README.txt b/contrib/README.txt index f2696e4997..0d5664a6df 100644 --- a/contrib/README.txt +++ b/contrib/README.txt @@ -38,6 +38,7 @@ Available libraries: - match -- pattern matching (Chris Double) - math -- extended math library (Doug Coleman, Slava Pestov) - parser-combinators -- Haskell-style parser combinators (Chris Double) +- porter-stemmer -- Porter stemming algorithm (Slava Pestov) - postgresql -- PostgreSQL binding (Doug Coleman) - process -- Run external programs (Slava Pestov, Doug Coleman) - random-tester -- Random compiler tester (Doug Coleman) diff --git a/contrib/all.factor b/contrib/all.factor index 81bd8cc585..16abd70309 100644 --- a/contrib/all.factor +++ b/contrib/all.factor @@ -9,7 +9,8 @@ contrib/hardware-info contrib/hexdump contrib/http contrib/httpd contrib/http-client contrib/jedit contrib/jni contrib/json contrib/lambda contrib/lazy-lists contrib/lindenmayer contrib/match contrib/math -contrib/parser-combinators contrib/postgresql contrib/process +contrib/parser-combinators contrib/porter-stemmer +contrib/postgresql contrib/process contrib/random-tester contrib/rss contrib/sequences contrib/serialize contrib/shuffle contrib/slate contrib/space-invaders contrib/splay-trees contrib/sqlite diff --git a/contrib/porter-stemmer/load.factor b/contrib/porter-stemmer/load.factor new file mode 100644 index 0000000000..71bfc9d0e1 --- /dev/null +++ b/contrib/porter-stemmer/load.factor @@ -0,0 +1,4 @@ +PROVIDE: contrib/porter-stemmer +{ +files+ { "porter-stemmer.factor" "porter-stemmer.facts" } } +{ +tests+ { "test/porter-stemmer.factor" } } +{ +help+ "porter-stemmer" } ; diff --git a/library/help/porter-stemmer.factor b/contrib/porter-stemmer/porter-stemmer.factor similarity index 100% rename from library/help/porter-stemmer.factor rename to contrib/porter-stemmer/porter-stemmer.factor diff --git a/library/help/porter-stemmer.facts b/contrib/porter-stemmer/porter-stemmer.facts similarity index 66% rename from library/help/porter-stemmer.facts rename to contrib/porter-stemmer/porter-stemmer.facts index f76f8a4907..e86340caa7 100644 --- a/library/help/porter-stemmer.facts +++ b/contrib/porter-stemmer/porter-stemmer.facts @@ -52,3 +52,21 @@ HELP: step5 HELP: stem { $values { "str" "a string" } { "newstr" "a new string" } } { $description "Applies the Porter stemming algorithm to the input string." } ; + +ARTICLE: "porter-stemmer" "Porter stemming algorithm" +"The help system uses the Porter stemming algorithm to normalize words when building the full-text search index." +$terpri +"The Factor implementation of the algorithm is based on the Common Lisp version, which was hand-translated from ANSI C by Steven M. Haflich. The original ANSI C was written by Martin Porter." +$terpri +"A detailed description of the algorithm, along with implementations in various languages, can be at in " { $url "http://www.tartarus.org/~martin/PorterStemmer" } "." +$terpri +"The main word of the algorithm takes an English word as input and outputs its stem:" +{ $subsection stem } +"The algorithm consists of a number of steps:" +{ $subsection step1a } +{ $subsection step1b } +{ $subsection step1c } +{ $subsection step2 } +{ $subsection step3 } +{ $subsection step4 } +{ $subsection step5 } ; diff --git a/library/test/help/porter-stemmer.factor b/contrib/porter-stemmer/test/porter-stemmer.factor similarity index 100% rename from library/test/help/porter-stemmer.factor rename to contrib/porter-stemmer/test/porter-stemmer.factor diff --git a/library/test/help/voc.txt b/contrib/porter-stemmer/test/voc.txt similarity index 100% rename from library/test/help/voc.txt rename to contrib/porter-stemmer/test/voc.txt