Class TokenInfoDictionary
- java.lang.Object
-
- org.apache.lucene.analysis.ja.dict.BinaryDictionary
-
- org.apache.lucene.analysis.ja.dict.TokenInfoDictionary
-
- All Implemented Interfaces:
Dictionary
public final class TokenInfoDictionary extends BinaryDictionary
Binary dictionary implementation for a known-word dictionary model: Words are encoded into an FST mapping to a list of wordIDs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classTokenInfoDictionary.SingletonHolder-
Nested classes/interfaces inherited from class org.apache.lucene.analysis.ja.dict.BinaryDictionary
BinaryDictionary.ResourceScheme
-
-
Field Summary
Fields Modifier and Type Field Description private TokenInfoFSTfststatic java.lang.StringFST_FILENAME_SUFFIX-
Fields inherited from class org.apache.lucene.analysis.ja.dict.BinaryDictionary
DICT_FILENAME_SUFFIX, DICT_HEADER, HAS_BASEFORM, HAS_PRONUNCIATION, HAS_READING, POSDICT_FILENAME_SUFFIX, POSDICT_HEADER, TARGETMAP_FILENAME_SUFFIX, TARGETMAP_HEADER, VERSION
-
Fields inherited from interface org.apache.lucene.analysis.ja.dict.Dictionary
INTERNAL_SEPARATOR
-
-
Constructor Summary
Constructors Modifier Constructor Description privateTokenInfoDictionary()TokenInfoDictionary(java.net.URL targetMapUrl, java.net.URL posDictUrl, java.net.URL dictUrl, java.net.URL fstUrl)Create aTokenInfoDictionaryfrom an external resource URL (e.g.TokenInfoDictionary(java.nio.file.Path targetMapFile, java.nio.file.Path posDictFile, java.nio.file.Path dictFile, java.nio.file.Path fstFile)Create aTokenInfoDictionaryfrom an external resource path.TokenInfoDictionary(BinaryDictionary.ResourceScheme resourceScheme, java.lang.String resourcePath)Deprecated, for removal: This API element is subject to removal in a future version.replaced byTokenInfoDictionary(Path, Path, Path, Path)for files andTokenInfoDictionary(URL, URL, URL, URL)for classpath/module resourcesprivateTokenInfoDictionary(IOSupplier<java.io.InputStream> targetMapResource, IOSupplier<java.io.InputStream> posResource, IOSupplier<java.io.InputStream> dictResource, IOSupplier<java.io.InputStream> fstResource)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.io.InputStreamgetClassResource(java.lang.String suffix)TokenInfoFSTgetFST()static TokenInfoDictionarygetInstance()-
Methods inherited from class org.apache.lucene.analysis.ja.dict.BinaryDictionary
getBaseForm, getInflectionForm, getInflectionType, getLeftId, getPartOfSpeech, getPronunciation, getReading, getResource, getRightId, getWordCost, lookupWordIds
-
-
-
-
Field Detail
-
FST_FILENAME_SUFFIX
public static final java.lang.String FST_FILENAME_SUFFIX
- See Also:
- Constant Field Values
-
fst
private final TokenInfoFST fst
-
-
Constructor Detail
-
TokenInfoDictionary
@Deprecated(forRemoval=true, since="9.1") public TokenInfoDictionary(BinaryDictionary.ResourceScheme resourceScheme, java.lang.String resourcePath) throws java.io.IOExceptionDeprecated, for removal: This API element is subject to removal in a future version.replaced byTokenInfoDictionary(Path, Path, Path, Path)for files andTokenInfoDictionary(URL, URL, URL, URL)for classpath/module resources- Parameters:
resourceScheme- - scheme for loading resources (FILE or CLASSPATH).resourcePath- - where to load resources (dictionaries) from.- Throws:
java.io.IOException
-
TokenInfoDictionary
public TokenInfoDictionary(java.nio.file.Path targetMapFile, java.nio.file.Path posDictFile, java.nio.file.Path dictFile, java.nio.file.Path fstFile) throws java.io.IOExceptionCreate aTokenInfoDictionaryfrom an external resource path.- Parameters:
targetMapFile- where to load target map resourceposDictFile- where to load POS dictionary resourcedictFile- where to load dictionary entries resourcefstFile- where to load encoded FST data resource- Throws:
java.io.IOException- if resource was not found or broken
-
TokenInfoDictionary
public TokenInfoDictionary(java.net.URL targetMapUrl, java.net.URL posDictUrl, java.net.URL dictUrl, java.net.URL fstUrl) throws java.io.IOExceptionCreate aTokenInfoDictionaryfrom 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 resourcefstUrl- where to load encoded FST data resource- Throws:
java.io.IOException- if resource was not found or broken
-
TokenInfoDictionary
private TokenInfoDictionary() throws java.io.IOException- Throws:
java.io.IOException
-
TokenInfoDictionary
private TokenInfoDictionary(IOSupplier<java.io.InputStream> targetMapResource, IOSupplier<java.io.InputStream> posResource, IOSupplier<java.io.InputStream> dictResource, IOSupplier<java.io.InputStream> fstResource) 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
-
getFST
public TokenInfoFST getFST()
-
getInstance
public static TokenInfoDictionary getInstance()
-
-