Class UnknownDictionary
- java.lang.Object
-
- org.apache.lucene.analysis.ko.dict.BinaryDictionary
-
- org.apache.lucene.analysis.ko.dict.UnknownDictionary
-
- All Implemented Interfaces:
Dictionary
public final class UnknownDictionary extends BinaryDictionary
Dictionary for unknown-word handling.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
UnknownDictionary.SingletonHolder
-
Nested classes/interfaces inherited from class org.apache.lucene.analysis.ko.dict.BinaryDictionary
BinaryDictionary.ResourceScheme
-
Nested classes/interfaces inherited from interface org.apache.lucene.analysis.ko.dict.Dictionary
Dictionary.Morpheme
-
-
Field Summary
Fields Modifier and Type Field Description private CharacterDefinition
characterDefinition
-
Fields inherited from class org.apache.lucene.analysis.ko.dict.BinaryDictionary
DICT_FILENAME_SUFFIX, DICT_HEADER, HAS_READING, HAS_SINGLE_POS, POSDICT_FILENAME_SUFFIX, POSDICT_HEADER, TARGETMAP_FILENAME_SUFFIX, TARGETMAP_HEADER, VERSION
-
-
Constructor Summary
Constructors Modifier Constructor Description private
UnknownDictionary()
UnknownDictionary(java.net.URL targetMapUrl, java.net.URL posDictUrl, java.net.URL dictUrl)
Create aUnknownDictionary
from an external resource URL (e.g.UnknownDictionary(java.nio.file.Path targetMapFile, java.nio.file.Path posDictFile, java.nio.file.Path dictFile)
Create aUnknownDictionary
from an external resource path.UnknownDictionary(BinaryDictionary.ResourceScheme scheme, java.lang.String resourcePath)
Deprecated, for removal: This API element is subject to removal in a future version.replaced byUnknownDictionary(Path, Path, Path)
for files andUnknownDictionary(URL, URL, URL)
for classpath/module resources
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CharacterDefinition
getCharacterDefinition()
private static java.io.InputStream
getClassResource(java.lang.String suffix)
static UnknownDictionary
getInstance()
Dictionary.Morpheme[]
getMorphemes(int wordId, char[] surfaceForm, int off, int len)
Get the morphemes of specified word (e.g.java.lang.String
getReading(int wordId)
Get the reading of specified word (mainly used for Hanja to Hangul conversion).-
Methods inherited from class org.apache.lucene.analysis.ko.dict.BinaryDictionary
getLeftId, getLeftPOS, getPOSType, getResource, getRightId, getRightPOS, getWordCost, lookupWordIds
-
-
-
-
Field Detail
-
characterDefinition
private final CharacterDefinition characterDefinition
-
-
Constructor Detail
-
UnknownDictionary
@Deprecated(forRemoval=true, since="9.1") public UnknownDictionary(BinaryDictionary.ResourceScheme scheme, java.lang.String resourcePath) throws java.io.IOException
Deprecated, for removal: This API element is subject to removal in a future version.replaced byUnknownDictionary(Path, Path, Path)
for files andUnknownDictionary(URL, URL, URL)
for classpath/module resources- Parameters:
scheme
- scheme for loading resources (FILE or CLASSPATH).resourcePath
- where to load resources from; a path, including the file base name without extension; this is used to match multiple files with the same base name.- Throws:
java.io.IOException
-
UnknownDictionary
public UnknownDictionary(java.nio.file.Path targetMapFile, java.nio.file.Path posDictFile, java.nio.file.Path dictFile) throws java.io.IOException
Create aUnknownDictionary
from an external resource path.- Parameters:
targetMapFile
- where to load target map resourceposDictFile
- where to load POS dictionary resourcedictFile
- where to load dictionary entries resource- Throws:
java.io.IOException
- if resource was not found or broken
-
UnknownDictionary
public UnknownDictionary(java.net.URL targetMapUrl, java.net.URL posDictUrl, java.net.URL dictUrl) throws java.io.IOException
Create aUnknownDictionary
from an external resource URL (e.g. from Classpath withClassLoader.getResource(String)
).- Parameters:
targetMapUrl
- where to load target map resourceposDictUrl
- where to load POS dictionary resourcedictUrl
- where to load dictionary entries resource- Throws:
java.io.IOException
- if resource was not found or broken
-
UnknownDictionary
private UnknownDictionary() throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getClassResource
private static java.io.InputStream getClassResource(java.lang.String suffix) throws java.io.IOException
- Throws:
java.io.IOException
-
getCharacterDefinition
public CharacterDefinition getCharacterDefinition()
-
getInstance
public static UnknownDictionary getInstance()
-
getReading
public java.lang.String getReading(int wordId)
Description copied from interface:Dictionary
Get the reading of specified word (mainly used for Hanja to Hangul conversion).- Specified by:
getReading
in interfaceDictionary
- Overrides:
getReading
in classBinaryDictionary
-
getMorphemes
public Dictionary.Morpheme[] getMorphemes(int wordId, char[] surfaceForm, int off, int len)
Description copied from interface:Dictionary
Get the morphemes of specified word (e.g. 가깝으나: 가깝 + 으나).- Specified by:
getMorphemes
in interfaceDictionary
- Overrides:
getMorphemes
in classBinaryDictionary
-
-