Class KatakanaRomanizer
- java.lang.Object
-
- org.apache.lucene.analysis.ja.completion.KatakanaRomanizer
-
public class KatakanaRomanizer extends java.lang.Object
Converts a Katakana string to Romaji using the pre-defined Katakana-Romaji mapping rules. Internally, this repeatedly performs prefix match on the given char sequence to the pre-built keystroke array until it reaches the end of the sequence, or there are no matched keystrokes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
KatakanaRomanizer.MatchedKeystroke
-
Field Summary
Fields Modifier and Type Field Description private static KatakanaRomanizer
INSTANCE
private CharsRef[][]
keystrokes
private static java.lang.String
ROMAJI_MAP_FILE
private java.util.Map<CharsRef,java.util.List<CharsRef>>
romajiMap
-
Constructor Summary
Constructors Modifier Constructor Description private
KatakanaRomanizer(CharsRef[][] keystrokes, java.util.Map<CharsRef,java.util.List<CharsRef>> romajiMap)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KatakanaRomanizer
getInstance()
Returns the singleton instance ofKatakanaRomenizer
private KatakanaRomanizer.MatchedKeystroke
longestKeystrokeMatch(CharsRef input, int inputOffset)
java.util.List<CharsRef>
romanize(CharsRef input)
Translates a sequence of katakana to romaji.
-
-
-
Field Detail
-
ROMAJI_MAP_FILE
private static final java.lang.String ROMAJI_MAP_FILE
- See Also:
- Constant Field Values
-
INSTANCE
private static KatakanaRomanizer INSTANCE
-
keystrokes
private final CharsRef[][] keystrokes
-
-
Method Detail
-
getInstance
public static KatakanaRomanizer getInstance()
Returns the singleton instance ofKatakanaRomenizer
-
romanize
public java.util.List<CharsRef> romanize(CharsRef input)
Translates a sequence of katakana to romaji. An input can produce multiple outputs because a keystroke can be mapped to multiple romajis.
-
longestKeystrokeMatch
private KatakanaRomanizer.MatchedKeystroke longestKeystrokeMatch(CharsRef input, int inputOffset)
-
-