JASSv2
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
JASS::stem_porter Class Reference

Generate the stem of a word using Porter's algorithm (version 1) More...

#include <stem_porter.h>

Inheritance diagram for JASS::stem_porter:
Inheritance graph
[legend]
Collaboration diagram for JASS::stem_porter:
Collaboration graph
[legend]

Public Member Functions

virtual ~stem_porter ()
 Detructor.
 
virtual std::string name (void)
 Return the name of the stemming algorithm. More...
 
virtual size_t tostem (char *destination, const char *source, size_t source_length)
 Stem from source into destination. More...
 
- Public Member Functions inherited from JASS::stem
 stem ()
 Constructor.
 
virtual ~stem ()
 Destructor.
 
virtual size_t tostem (parser::token &destination, const parser::token &source)
 Stem from term into destination. More...
 

Static Public Member Functions

static void unittest (void)
 Unit test this class.
 
- Static Public Member Functions inherited from JASS::stem
static void unittest (void)
 Unit test this class.
 

Private Member Functions

bool isvowely (const char *c)
 Is the character at this point a vowel according to Porter's definision. More...
 
bool cvc (const char *what)
 Porter's "*o" rule, the stem ends cvc, where the second c is not W, X or Y (e.g. -WIL, -HOP). More...
 
size_t length (const char *reversed)
 Return Porter's m in [C](VC)m[V], the length of the stem. More...
 
bool has_vowel (const char *what)
 Does the string contain a vowel? More...
 

Private Attributes

std::string workspace
 

Detailed Description

Generate the stem of a word using Porter's algorithm (version 1)

see: M.F. Porter, An algoritm for suffix stripping, Program, Vol 14, No 3, pp 130-137, July 1980 This code came from ATIRE, and has a few bug fixes applied (especially to rule 1)

Member Function Documentation

◆ cvc()

bool JASS::stem_porter::cvc ( const char *  what)
inlineprivate

Porter's "*o" rule, the stem ends cvc, where the second c is not W, X or Y (e.g. -WIL, -HOP).

Parameters
what[in] where to check
Returns
true or false.

◆ has_vowel()

bool JASS::stem_porter::has_vowel ( const char *  what)
private

Does the string contain a vowel?

Parameters
what[in] Where to check.
Returns
true if the string contains a vowel, false otherwise.

◆ isvowely()

bool JASS::stem_porter::isvowely ( const char *  c)
inlineprivate

Is the character at this point a vowel according to Porter's definision.

Porter states: "A consonant in a word is a letter other than A, E, I, O or U, and other than Y preceded by a consonant." ... "If a letter is not a consonant it is a vowel." so a vowely is {aeiou} or {y} not folowed by a {aeiou}

Parameters
c[in] Pointer to the character to check.
Returns
true if a vowely or false otherwise.

◆ length()

size_t JASS::stem_porter::length ( const char *  reversed)
private

Return Porter's m in [C](VC)m[V], the length of the stem.

Parameters
reversed[in] The string to count m on.
Returns
The length of the stem in units of m

◆ name()

virtual std::string JASS::stem_porter::name ( void  )
inlinevirtual

Return the name of the stemming algorithm.

Returns
The name of the stemmer

Implements JASS::stem.

◆ tostem()

size_t JASS::stem_porter::tostem ( char *  destination,
const char *  source,
size_t  source_length 
)
virtual

Stem from source into destination.

Parameters
destination[out] the result of the steming process (the stem)
source[in] the term to stem
source_length[in] the length of the string to stem
Returns
the length of the stem

Implements JASS::stem.


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