% This LaTeX document was generated using the LaTeX backend of PlDoc, % The SWI-Prolog documentation system \section{library(snowball): The Snowball multi-lingual stemmer library} \label{sec:snowball} \begin{tags} \tag{See also} \url{http://snowball.tartarus.org/} \end{tags} This module encapsulates "The C version of the libstemmer library" from the Snowball project. This library provides stemmers in a variety of languages. The interface to this library is very simple: \begin{itemize} \item \predref{snowball}{3} stems a word with a given algorithm \item \predref{snowball_current_algorithm}{1} enumerates the provided algorithms. \end{itemize} Here is an example: \begin{code} ?- snowball(english, walking, S). S = walk. \end{code} \vspace{0.7cm} \begin{description} \predicate[det]{snowball}{3}{+Algorithm, +Input, -Stem} Apply the Snowball \arg{Algorithm} on \arg{Input} and unify the result (an atom) with \arg{Stem}. The implementation maintains a cache of stemmers for each thread that accesses \predref{snowball}{3}, providing high-perfomance and thread-safety without locking. \begin{arguments} \arg{Algorithm} & is the (english) name for desired algorithm or an 2 or 3 letter ISO 639 language code. \\ \arg{Input} & is the word to be stemmed. It is either an atom, string or list of chars/codes. The library accepts Unicode characters. \arg{Input} must be \textit{lowercase}. See \predref{downcase_atom}{2}. \\ \end{arguments} \begin{tags} \mtag{Errors}- \verb$domain_error(snowball_algorithm, Algorithm)$ \\- \verb$type_error(atom, Algorithm)$ \\- \verb$type_error(text, Input)$ \end{tags} \predicate[nondet]{snowball_current_algorithm}{1}{?Algorithm} True if \arg{Algorithm} is the official name of an algorithm suported by \predref{snowball}{3}. The predicate is \const{semidet} if \arg{Algorithm} is given. \end{description}