GSpell

GSpell is a spelling suggestion tool.

See:
          Description

Packages
gov.nih.nlm.nls.dbm dbm is a package that allows for persistant store of indexed material.
gov.nih.nlm.nls.gspell GSpell is a spelling suggestion tool.
gov.nih.nlm.nls.utils  

 

GSpell is a spelling suggestion tool. It indexes a set of words or terms, and provides a retrieval mechanism to retrieve close suggestions to input terms. Java API's are provided for developers to embed this application in their applications. Two programs are provided, GSPell, and CommonMisspellings. GSpell is the general spelling suggestion tool. The auxilliary CommonMispellings program is provided as the mechanism for inserting and updating common misspelling by correct spelling pairs.

Aspell is a thin wrapper around Kevin Atkinson's fine Aspell spelling suggestion tool. This wrapper is being provided as a means for uniform comparision between GSpell and Aspell.

Java API's

GSpell Package

It should be possible to embed this package into other applications using the following constructors and methods for the class GSpell.

Gspell instances can be embedded into single threaded applications with no problem. It can be embedded into threaded applications with the following advice:

Embedding read-only instances of GSpell objects is fine as long as there are no read/write instances present.

It is recommended that in cases where there are updates or read/writes, this object gets implemented as a singleton instance per dictionary, that is shared across threads and processes.

There is NO writer lock and unlock around the update/index method, nor around the cleanup or flush methods to insure that only one writer is alive at any given time, and that there are no readers alive. It is up to the application developer to insure that access is controlled around GSpell Object instances that do writes or updates.

To create
or update
an index
public GSpell(Options pOptions) throws Exception
public GSpell(String pDictionaryName, int pMode) throws Exception
public int index( BufferedReader pFStream ) throws Exception
public void index( String pTerm ) throws Exception
public int update( BufferedReader pFStream ) throws Exception
public void update( String pTerm ) throws Exception
To retrieve
suggestions
for terms
public GSpell(Options pOptions) throws Exception
public GSpell(String pDictionaryName, int pMode) throws Exception
public int find( BufferedReader pFStream, PrintWriter pPrintStream ) throws Exception
public Candidate[] find( String pTerm ) throws Exception
public Candidate[] find( FindOptions fOptions, String pTerm ) throws Exception
It is
instructive
to review
the methods
from the
Candidate
class.
public String getName()
public double getEditDistance()
public double getRank()
public String getFromMethod()
public String getMessage()
public String toString()
GSpell Options
and Find Options
Options(int pMode, java.lang.String pDictionaryName, java.lang.String pDictionaryDir)
FindOptions getFindOptions()

API Examples

Examples that illustrate embedding this in an application are provided in the examples directory.


Copyright, Privacy, and Disclaimer Notice
Last modified: Mon Jun 17 16:42:00 Eastern Daylight Time 2002



The use and distribution of this material is subject to the terms and conditions included in the file SPECIALIST_NLP_TOOLS_TERMS_AND_CONDITIONS.TXT, located in the root directory of the distribution.