org.itc.irst.tcc.sre.util
Class StemmerFactory

java.lang.Object
  extended by org.itc.irst.tcc.sre.util.StemmerFactory

public class StemmerFactory
extends java.lang.Object

Factory class for vending standard Stemmer objects. Wherever possible, this factory will hand out references to shared Stemmer instances.

Since:
1.0
Version:
1.0
Author:
Claudio Giuliano

Field Summary
private  java.util.Properties initParams
           
(package private) static org.apache.log4j.Logger logger
          Define a static logger variable so that it references the Logger instance named StemmerFactory.
private static StemmerFactory stemmerFactory
          A prototype for a stemmer factory such that only one instance class can ever exist.
 
Constructor Summary
private StemmerFactory()
          Constructs a StemmerFactory object.
 
Method Summary
 void addStemmer(java.lang.String stemmerName, java.lang.String stemmerClass)
           
 Stemmer getInstance(java.lang.String name)
          Returns the id of the specified stemmer and adds the stemmer to the lexicon if it is not present yet.
static StemmerFactory getStemmerFactory()
          Returns StemmerFactory object; only one StemmerFactory instance can exist.
static void main(java.lang.String[] args)
           
 java.lang.String toString()
          Returns a String object representing this StemmerFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger
Define a static logger variable so that it references the Logger instance named StemmerFactory.


stemmerFactory

private static StemmerFactory stemmerFactory
A prototype for a stemmer factory such that only one instance class can ever exist.


initParams

private java.util.Properties initParams
Constructor Detail

StemmerFactory

private StemmerFactory()
Constructs a StemmerFactory object.

Method Detail

addStemmer

public void addStemmer(java.lang.String stemmerName,
                       java.lang.String stemmerClass)

getInstance

public Stemmer getInstance(java.lang.String name)
                    throws StemmerNotFoundException
Returns the id of the specified stemmer and adds the stemmer to the lexicon if it is not present yet.

If the lexicon is read only, stemmers not already present in the lexicon will not be added and a null id will be returned.

Parameters:
name - the string representation of the stemmer.
Returns:
the id of the specified stemmer.
Throws:
StemmerNotFoundException

toString

public java.lang.String toString()
Returns a String object representing this StemmerFactory.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object.

getStemmerFactory

public static StemmerFactory getStemmerFactory()
Returns StemmerFactory object; only one StemmerFactory instance can exist.

Returns:
StemmerFactory object

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception