org.basex.util.ft
Class Stemmer

java.lang.Object
  extended by org.basex.util.ft.FTIterator
      extended by org.basex.util.ft.Stemmer
All Implemented Interfaces:
java.lang.Comparable<org.basex.util.ft.LanguageImpl>, java.util.Iterator<FTSpan>
Direct Known Subclasses:
InternalStemmer

public abstract class Stemmer
extends FTIterator

Implementation of common stemmer methods.

Author:
BaseX Team 2005-12, BSD License, Dimitar Popov

Method Summary
 int compareTo(org.basex.util.ft.LanguageImpl o)
           
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean hasNext()
           
 Stemmer init(byte[] txt)
          Initializes the iterator.
 FTSpan next()
           
 byte[] nextToken()
          Returns the next token.
protected abstract  byte prec()
          Returns the precedence of the processor.
protected abstract  byte[] stem(byte[] word)
          Stems a word.
static boolean supportFor(Language l)
          Checks if the language is supported by the available stemmers.
 boolean supports(Language ln)
          Checks if the specified language is supported.
 java.lang.String toString()
           
 
Methods inherited from class org.basex.util.ft.FTIterator
remove
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

supportFor

public static boolean supportFor(Language l)
Checks if the language is supported by the available stemmers.

Parameters:
l - language to be found
Returns:
result of check

stem

protected abstract byte[] stem(byte[] word)
Stems a word.

Parameters:
word - input word to stem
Returns:
the stem of the word

init

public final Stemmer init(byte[] txt)
Description copied from class: FTIterator
Initializes the iterator.

Specified by:
init in class FTIterator
Parameters:
txt - text
Returns:
self reference

hasNext

public final boolean hasNext()

next

public final FTSpan next()

nextToken

public final byte[] nextToken()
Description copied from class: FTIterator
Returns the next token. May be called as an alternative to Iterator.next() to avoid the creation of new FTSpan instances.

Specified by:
nextToken in class FTIterator
Returns:
token

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

prec

protected abstract byte prec()
Returns the precedence of the processor. If two language implementations support the same language, the processor with the higher precedence will be selected.

Returns:
precedence

supports

public boolean supports(Language ln)
Checks if the specified language is supported.

Parameters:
ln - language
Returns:
true if language is supported

equals

public final boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

compareTo

public final int compareTo(org.basex.util.ft.LanguageImpl o)
Specified by:
compareTo in interface java.lang.Comparable<org.basex.util.ft.LanguageImpl>

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object