Class UnknownDictionary

  • All Implemented Interfaces:
    Dictionary

    public final class UnknownDictionary
    extends BinaryDictionary
    Dictionary for unknown-word handling.
    • Constructor Detail

      • UnknownDictionary

        @Deprecated(forRemoval=true,
                    since="9.1")
        public UnknownDictionary​(BinaryDictionary.ResourceScheme scheme,
                                 java.lang.String path)
                          throws java.io.IOException
        Deprecated, for removal: This API element is subject to removal in a future version.
        replaced by UnknownDictionary(Path, Path, Path) for files and UnknownDictionary(URL, URL, URL) for classpath/module resources
        Parameters:
        scheme - scheme for loading resources (FILE or CLASSPATH).
        path - 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 a UnknownDictionary from an external resource path.
        Parameters:
        targetMapFile - where to load target map resource
        posDictFile - where to load POS dictionary resource
        dictFile - 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 a UnknownDictionary from an external resource URL (e.g. from Classpath with ClassLoader.getResource(String)).
        Parameters:
        targetMapUrl - where to load target map resource
        posDictUrl - where to load POS dictionary resource
        dictUrl - 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
      • lookup

        public int lookup​(char[] text,
                          int offset,
                          int len)
      • getReading

        public java.lang.String getReading​(int wordId,
                                           char[] surface,
                                           int off,
                                           int len)
        Description copied from interface: Dictionary
        Get reading of tokens
        Specified by:
        getReading in interface Dictionary
        Overrides:
        getReading in class BinaryDictionary
        Parameters:
        wordId - word ID of token
        Returns:
        Reading of the token