Class BinaryDictionary
java.lang.Object
org.apache.lucene.analysis.ko.dict.BinaryDictionary
- All Implemented Interfaces:
Dictionary
- Direct Known Subclasses:
TokenInfoDictionary,UnknownDictionary
Base class for a binary-encoded in-memory dictionary.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDeprecated, for removal: This API element is subject to removal in a future version.Nested classes/interfaces inherited from interface org.apache.lucene.analysis.ko.dict.Dictionary
Dictionary.Morpheme -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBufferstatic final Stringstatic final Stringstatic final intflag that the entry has reading data.static final intflag that the entry has a single part of speech (leftPOS)private final POS.Tag[]static final Stringstatic final Stringprivate final int[]static final Stringstatic final Stringprivate final int[]static final int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBinaryDictionary(IOSupplier<InputStream> targetMapResource, IOSupplier<InputStream> posResource, IOSupplier<InputStream> dictResource) -
Method Summary
Modifier and TypeMethodDescriptionintgetLeftId(int wordId) Get left id of specified wordgetLeftPOS(int wordId) Get the leftPOS.Tagof specfied word.getMorphemes(int wordId, char[] surfaceForm, int off, int len) Get the morphemes of specified word (e.g.getPOSType(int wordId) Get thePOS.Typeof specified word (morpheme, compound, inflect or pre-analysis)getReading(int wordId) Get the reading of specified word (mainly used for Hanja to Hangul conversion).static final InputStreamgetResource(BinaryDictionary.ResourceScheme scheme, String path) Deprecated, for removal: This API element is subject to removal in a future version.intgetRightId(int wordId) Get right id of specified wordgetRightPOS(int wordId) Get the rightPOS.Tagof specfied word.intgetWordCost(int wordId) Get word cost of specified wordprivate booleanhasReadingData(int wordId) private booleanhasSinglePOS(int wordId) voidlookupWordIds(int sourceId, IntsRef ref) private static voidpopulateTargetMap(DataInput in, int[] targetMap, int[] targetMapOffsets) private StringreadString(int offset)
-
Field Details
-
TARGETMAP_FILENAME_SUFFIX
- See Also:
-
DICT_FILENAME_SUFFIX
- See Also:
-
POSDICT_FILENAME_SUFFIX
- See Also:
-
DICT_HEADER
- See Also:
-
TARGETMAP_HEADER
- See Also:
-
POSDICT_HEADER
- See Also:
-
VERSION
public static final int VERSION- See Also:
-
buffer
-
targetMapOffsets
private final int[] targetMapOffsets -
targetMap
private final int[] targetMap -
posDict
-
HAS_SINGLE_POS
public static final int HAS_SINGLE_POSflag that the entry has a single part of speech (leftPOS)- See Also:
-
HAS_READING
public static final int HAS_READINGflag that the entry has reading data. otherwise reading is surface form- See Also:
-
-
Constructor Details
-
BinaryDictionary
protected BinaryDictionary(IOSupplier<InputStream> targetMapResource, IOSupplier<InputStream> posResource, IOSupplier<InputStream> dictResource) throws IOException - Throws:
IOException
-
-
Method Details
-
populateTargetMap
private static void populateTargetMap(DataInput in, int[] targetMap, int[] targetMapOffsets) throws IOException - Throws:
IOException
-
getResource
@Deprecated(forRemoval=true, since="9.1") public static final InputStream getResource(BinaryDictionary.ResourceScheme scheme, String path) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
lookupWordIds
-
getLeftId
public int getLeftId(int wordId) Description copied from interface:DictionaryGet left id of specified word- Specified by:
getLeftIdin interfaceDictionary
-
getRightId
public int getRightId(int wordId) Description copied from interface:DictionaryGet right id of specified word- Specified by:
getRightIdin interfaceDictionary
-
getWordCost
public int getWordCost(int wordId) Description copied from interface:DictionaryGet word cost of specified word- Specified by:
getWordCostin interfaceDictionary
-
getPOSType
Description copied from interface:DictionaryGet thePOS.Typeof specified word (morpheme, compound, inflect or pre-analysis)- Specified by:
getPOSTypein interfaceDictionary
-
getLeftPOS
Description copied from interface:DictionaryGet the leftPOS.Tagof specfied word.For
POS.Type.MORPHEMEandPOS.Type.COMPOUNDthe left and right POS are the same.- Specified by:
getLeftPOSin interfaceDictionary
-
getRightPOS
Description copied from interface:DictionaryGet the rightPOS.Tagof specfied word.For
POS.Type.MORPHEMEandPOS.Type.COMPOUNDthe left and right POS are the same.- Specified by:
getRightPOSin interfaceDictionary
-
getReading
Description copied from interface:DictionaryGet the reading of specified word (mainly used for Hanja to Hangul conversion).- Specified by:
getReadingin interfaceDictionary
-
getMorphemes
Description copied from interface:DictionaryGet the morphemes of specified word (e.g. 가깝으나: 가깝 + 으나).- Specified by:
getMorphemesin interfaceDictionary
-
readString
-
hasSinglePOS
private boolean hasSinglePOS(int wordId) -
hasReadingData
private boolean hasReadingData(int wordId)
-