com.swabunga.spell.engine
Class GenericTransformator
java.lang.Object
com.swabunga.spell.engine.GenericTransformator
- All Implemented Interfaces:
- Transformator
- public class GenericTransformator
- extends java.lang.Object
- implements Transformator
A Generic implementation of a transformator takes an aspell phonetics file and constructs
some sort of transformation table using the inner class Rule.
- Author:
- Robert Gustavsson ([email protected])
Method Summary |
char[] |
getCodeReplaceList()
Takes out all single character replacements and put them in a char array. |
char[] |
getReplaceList()
Builds up an char array with the chars in the alphabet of the language as it was read from the
alphabet tag in the phonetic file. |
java.lang.String |
transform(java.lang.String word)
Returns the phonetic code of the word. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ALPHABET_START
public static final char ALPHABET_START
- See Also:
- Constant Field Values
ALPHABET_END
public static final char ALPHABET_END
- See Also:
- Constant Field Values
KEYWORD_ALPHBET
public static final java.lang.String KEYWORD_ALPHBET
- See Also:
- Constant Field Values
IGNORED_KEYWORDS
public static final java.lang.String[] IGNORED_KEYWORDS
STARTMULTI
public static final char STARTMULTI
- See Also:
- Constant Field Values
ENDMULTI
public static final char ENDMULTI
- See Also:
- Constant Field Values
DIGITCODE
public static final java.lang.String DIGITCODE
- See Also:
- Constant Field Values
REPLACEVOID
public static final java.lang.String REPLACEVOID
- See Also:
- Constant Field Values
GenericTransformator
public GenericTransformator(java.io.File phonetic)
throws java.io.IOException
GenericTransformator
public GenericTransformator(java.io.File phonetic,
java.lang.String encoding)
throws java.io.IOException
GenericTransformator
public GenericTransformator(java.io.Reader phonetic)
throws java.io.IOException
getCodeReplaceList
public char[] getCodeReplaceList()
- Takes out all single character replacements and put them in a char array.
This array can later be used for adding or changing letters in getSuggestion().
- Returns:
- char[] An array of chars with replacements characters
getReplaceList
public char[] getReplaceList()
- Builds up an char array with the chars in the alphabet of the language as it was read from the
alphabet tag in the phonetic file.
- Specified by:
getReplaceList
in interface Transformator
- Returns:
- char[] An array of chars representing the alphabet or null if no alphabet was available.
transform
public java.lang.String transform(java.lang.String word)
- Returns the phonetic code of the word.
- Specified by:
transform
in interface Transformator