edu.iastate.jtm
Class PluralDetector

java.lang.Object
  extended by edu.iastate.jtm.PluralDetector

public class PluralDetector
extends java.lang.Object

Lookup a noun's singular form against a dictionary.

Author:
dingjing

Constructor Summary
PluralDetector()
           
PluralDetector(java.io.File dicFile)
          Creates a new instance of PluralDetector.
PluralDetector(java.net.URL dicUrl)
           
 
Method Summary
 void loadDictionary(java.io.File dicFile, boolean keyFirst)
           
 void loadDictionary(java.net.URL dicUrl, boolean keyFirst)
           
static void main(java.lang.String[] args)
          For test.
 void setCheckAbb(boolean c)
           
 void singlize(java.nio.CharBuffer plural)
           
 java.lang.String singlize(java.lang.String plural)
          Return singular form of a plural.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluralDetector

public PluralDetector(java.io.File dicFile)
               throws java.io.IOException
Creates a new instance of PluralDetector. Load the dictionary only once.

Parameters:
dicFile - plural dictionary file.
Throws:
java.io.IOException

PluralDetector

public PluralDetector(java.net.URL dicUrl)
               throws java.io.IOException
Throws:
java.io.IOException

PluralDetector

public PluralDetector()
Method Detail

setCheckAbb

public void setCheckAbb(boolean c)

loadDictionary

public void loadDictionary(java.io.File dicFile,
                           boolean keyFirst)
                    throws java.io.IOException
Throws:
java.io.IOException

loadDictionary

public void loadDictionary(java.net.URL dicUrl,
                           boolean keyFirst)
                    throws java.io.IOException
Throws:
java.io.IOException

singlize

public java.lang.String singlize(java.lang.String plural)
Return singular form of a plural. If the word is not a plural noun, return the original word.

Parameters:
plural - the plural word.
Returns:
singular form of the word.

singlize

public void singlize(java.nio.CharBuffer plural)

main

public static void main(java.lang.String[] args)
For test.

Parameters:
args - the command line arguments