Xapian::Stem Class Reference

Class representing a stemming algorithm. More...

`#include <stem.h>`

## Public Member Functions

| Stem (const Stem &o)
| Copy constructor.
Stem & | operator= (const Stem &o)
| Assignment.
| Stem ()
| Construct a Xapian::Stem object which doesn't change terms.
| Stem (StemImplementation *p)
| Construct a Xapian::Stem object with a user-provided stemming algorithm.
| ~Stem ()
| Destructor.
std::string | operator() (const std::string &word) const
| Stem a word.
bool | is_none () const
| Return true if this is a no-op stemmer.
std::string | get_description () const
| Return a string describing this object.
| Stem (const std::string &language)
| Construct a Xapian::Stem object for a particular language.
| Stem (const std::string &language, bool fallback)
| Construct a Xapian::Stem object for a particular language.

## Static Public Member Functions

static std::string | get_available_languages ()
| Return a list of available languages.

## Detailed Description

Class representing a stemming algorithm.

## Constructor & Destructor Documentation

## Stem() [1/4]

Xapian::Stem::Stem | ( |  | ) |

Construct a Xapian::Stem object which doesn't change terms.

Equivalent to Stem("none").

## Stem() [2/4]

Xapian::Stem::Stem | ( | const std::string & | language | ) |

explicit

Construct a Xapian::Stem object for a particular language.

Parameters

  language | Either the English name for the language or the two letter ISO639 code.

The following language names are understood (aliases follow the name):

- none - don't stem terms
- arabic (ar) - Since Xapian 1.3.5
- armenian (hy) - Since Xapian 1.3.0
- basque (eu) - Since Xapian 1.3.0
- catalan (ca) - Since Xapian 1.3.0
- danish (da)
- dutch (nl)
- english (en) - Martin Porter's 2002 revision of his stemmer
- earlyenglish - Early English (e.g. Shakespeare, Dickens) stemmer (since Xapian 1.3.2)
- english_lovins (lovins) - Lovin's stemmer
- english_porter (porter) - Porter's stemmer as described in his 1980 paper
- finnish (fi)
- french (fr)
- german (de)
- german2 - Normalises umlauts and ß
- hungarian (hu)
- indonesian (id) - Since Xapian 1.4.6
- irish (ga) - Since Xapian 1.4.7
- italian (it)
- kraaij_pohlmann - A different Dutch stemmer
- lithuanian (lt) - Since Xapian 1.4.7
- nepali (ne) - Since Xapian 1.4.7
- norwegian (nb, nn, no)
- portuguese (pt)
- romanian (ro)
- russian (ru)
- spanish (es)
- swedish (sv)
- tamil (ta) - Since Xapian 1.4.7
- turkish (tr)

Parameters

  fallback | If true then treat unknown language as "none", otherwise an exception is thrown (default: false). Parameter added in Xapian 1.4.14 - older versions always threw an exception.

Exceptions

  Xapian::InvalidArgumentError | is thrown if language isn't recognised and fallback is false.

## Stem() [3/4]

Xapian::Stem::Stem | ( | const std::string & | language,
|  | bool | fallback
| ) |  |

Construct a Xapian::Stem object for a particular language.

Parameters

  language | Either the English name for the language or the two letter ISO639 code.

The following language names are understood (aliases follow the name):

- none - don't stem terms
- arabic (ar) - Since Xapian 1.3.5
- armenian (hy) - Since Xapian 1.3.0
- basque (eu) - Since Xapian 1.3.0
- catalan (ca) - Since Xapian 1.3.0
- danish (da)
- dutch (nl)
- english (en) - Martin Porter's 2002 revision of his stemmer
- earlyenglish - Early English (e.g. Shakespeare, Dickens) stemmer (since Xapian 1.3.2)
- english_lovins (lovins) - Lovin's stemmer
- english_porter (porter) - Porter's stemmer as described in his 1980 paper
- finnish (fi)
- french (fr)
- german (de)
- german2 - Normalises umlauts and ß
- hungarian (hu)
- indonesian (id) - Since Xapian 1.4.6
- irish (ga) - Since Xapian 1.4.7
- italian (it)
- kraaij_pohlmann - A different Dutch stemmer
- lithuanian (lt) - Since Xapian 1.4.7
- nepali (ne) - Since Xapian 1.4.7
- norwegian (nb, nn, no)
- portuguese (pt)
- romanian (ro)
- russian (ru)
- spanish (es)
- swedish (sv)
- tamil (ta) - Since Xapian 1.4.7
- turkish (tr)

Parameters

  fallback | If true then treat unknown language as "none", otherwise an exception is thrown (default: false). Parameter added in Xapian 1.4.14 - older versions always threw an exception.

Exceptions

  Xapian::InvalidArgumentError | is thrown if language isn't recognised and fallback is false.

## Stem() [4/4]

Xapian::Stem::Stem | ( | StemImplementation * | p | ) |

explicit

Construct a Xapian::Stem object with a user-provided stemming algorithm.

You can subclass Xapian::StemImplementation to implement your own stemming algorithm (or to wrap a third-party algorithm) and then wrap your implementation in a Xapian::Stem object to pass to the Xapian API.

Parameters

  p | The user-subclassed StemImplementation object. This is reference counted, and so will be automatically deleted by the Xapian::Stem wrapper when no longer required.

## Member Function Documentation

## get_available_languages()

static std::string Xapian::Stem::get_available_languages | ( |  | ) |

inlinestatic

Return a list of available languages.

Each stemmer is only included once in the list (not once for each alias). The name included is the English name of the language.

The list is returned as a string, with language names separated by spaces. This is a static method, so a Xapian::Stem object is not required for this operation.

## operator()()

std::string Xapian::Stem::operator() | ( | const std::string & | word | ) | const

Stem a word.

Parameters

  word | a word to stem.

Returns
  the stem

The documentation for this class was generated from the following file:

- xapian/stem.h