public class GenericTransformator extends java.lang.Object implements Transformator
SpellDictionaryASpell for information on getting
phonetic files for aspell.
Modifier and Type | Field and Description |
---|---|
static char |
ALPHABET_END
The alphabet end marker.
|
static char |
ALPHABET_START
The alphabet start marker.
|
static java.lang.String |
DIGITCODE
During phonetic transformation of a word each numeric character is
replaced by this DIGITCODE.
|
static char |
ENDMULTI
End a group of characters which can be appended to the match expression
of the phonetic file.
|
static java.lang.String[] |
IGNORED_KEYWORDS
Phonetic file lines starting with the keywords are skipped.
|
static java.lang.String |
KEYWORD_ALPHBET
Phonetic file keyword indicating that a different alphabet is used
for this language.
|
static java.lang.String |
REPLACEVOID
Phonetic file character code indicating that the replace expression
is empty.
|
static char |
STARTMULTI
Start a group of characters which can be appended to the match expression
of the phonetic file.
|
Constructor and Description |
---|
GenericTransformator(java.io.File phonetic)
Construct a transformation table from the phonetic file
|
GenericTransformator(java.io.File phonetic,
java.lang.String encoding)
Construct a transformation table from the phonetic file
|
GenericTransformator(java.io.Reader phonetic)
Construct a transformation table from the phonetic file
|
Modifier and Type | Method and Description |
---|---|
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)
Builds the phonetic code of the word.
|
public static final char ALPHABET_START
KEYWORD_ALPHBET
,
Constant Field Valuespublic static final char ALPHABET_END
KEYWORD_ALPHBET
,
Constant Field Valuespublic static final java.lang.String KEYWORD_ALPHBET
ALPHABET_START
marker,
a list of characters defining the alphabet and a
ALPHABET_END
marker.public static final java.lang.String[] IGNORED_KEYWORDS
public static final char STARTMULTI
public static final char ENDMULTI
public static final java.lang.String DIGITCODE
public static final java.lang.String REPLACEVOID
public GenericTransformator(java.io.File phonetic) throws java.io.IOException
phonetic
- the phonetic file as specified in aspelljava.io.IOException
- indicates a problem while reading
the phonetic filepublic GenericTransformator(java.io.File phonetic, java.lang.String encoding) throws java.io.IOException
phonetic
- the phonetic file as specified in aspellencoding
- the character set requiredjava.io.IOException
- indicates a problem while reading
the phonetic filepublic GenericTransformator(java.io.Reader phonetic) throws java.io.IOException
phonetic
- the phonetic file as specified in aspell. The file is
supplied as a reader.java.io.IOException
- indicates a problem while reading
the phonetic informationpublic char[] getCodeReplaceList()
public char[] getReplaceList()
getReplaceList
in interface Transformator
public java.lang.String transform(java.lang.String word)
transform
in interface Transformator
word
- the word to transform