Class HunspellDictionaryDownload

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

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

    • downloadFromCatalog

      public static void downloadFromCatalog(DictionaryCatalog catalog, String dictionaryId, Path targetDirectory) throws IOException
      Downloads 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.