Class HunspellDictionaryInstaller

java.lang.Object
opennlp.tools.stemmer.hunspell.HunspellDictionaryInstaller

public final class HunspellDictionaryInstaller extends Object
Opt-in installation of Hunspell .aff/.dic pairs and their license readme from an application-supplied DictionaryCatalog. Requires DictionaryCatalog.REMOTE_DOWNLOAD_PROPERTY to be true. OpenNLP bundles neither a catalog nor dictionary data.
Since:
3.0.0
  • Method Details

    • installFromCatalog

      public static void installFromCatalog(DictionaryCatalog catalog, String dictionaryId, Path targetDirectory) throws IOException
      Installs the cataloged .aff, .dic, and readme files for dictionaryId into targetDirectory. Each file uses its configured name or source name, for example en_US.aff. Existing target files are not replaced, so they must be removed before refreshing a dictionary.
      Parameters:
      catalog - The application-supplied catalog. Must not be null.
      dictionaryId - The catalog dictionary name, for example en_US. Must not be null.
      targetDirectory - The directory to write into; created when absent. Must not be null.
      Throws:
      IOException - Thrown if remote downloads are disabled, a catalog entry is missing, verification fails, or the target already contains one of the files.
      IllegalArgumentException - Thrown if a parameter is null.