ca.site.elkb
Class Variant

java.lang.Object
  extended by ca.site.elkb.Variant
All Implemented Interfaces:
java.io.Serializable

public class Variant
extends java.lang.Object
implements java.io.Serializable

Allows to obtain a variant of an English spelling. A British spelling variant can be obtained form an American spelling and vice-versa.

The default American and British word list is AmBr.lst contained in the $HOME/roget_elkb directory. It is loaded by the default constructor.

Version:
1.4 2013
Author:
Mario Jarmasz and Alistsair Kennedy
See Also:
Serialized Form

Field Summary
static java.lang.String AMBR_FILE
          Location of the default American and British spelling word list.
static java.lang.String ELKB_PATH
          Location of the ELKB data directory.
static java.lang.String USER_HOME
          Location of user's Home directory.
 
Constructor Summary
Variant()
          Default constructor.
Variant(java.lang.String filename)
          Constructor that builds the Variant object using the information contained in the specified file.
 
Method Summary
 java.lang.String amToBr(java.lang.String american)
          Returns the British spelling of a word, or null if the word cannot be found.
 java.lang.String brToAm(java.lang.String british)
          Returns the American spelling of a word, or null if the word cannot be found.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_HOME

public static final java.lang.String USER_HOME
Location of user's Home directory.


ELKB_PATH

public static final java.lang.String ELKB_PATH
Location of the ELKB data directory.


AMBR_FILE

public static final java.lang.String AMBR_FILE
Location of the default American and British spelling word list.

Constructor Detail

Variant

public Variant()
Default constructor.


Variant

public Variant(java.lang.String filename)
Constructor that builds the Variant object using the information contained in the specified file. This file must contain only the American and British spellings in the following format:
American spelling:British spellling.
For example:
airplane:aeroplane

Parameters:
filename -
Method Detail

amToBr

public java.lang.String amToBr(java.lang.String american)
Returns the British spelling of a word, or null if the word cannot be found.

Parameters:
american -
Returns:
British translation

brToAm

public java.lang.String brToAm(java.lang.String british)
Returns the American spelling of a word, or null if the word cannot be found.

Parameters:
british -
Returns:
American translation