Tabnine Logo
Dictionary.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.lucene.analysis.hunspell.Dictionary
constructor

Best Java code snippets using org.apache.lucene.analysis.hunspell.Dictionary.<init> (Showing top 8 results out of 315)

origin: org.apache.lucene/lucene-analyzers-common

@Override
public void inform(ResourceLoader loader) throws IOException {
 String dicts[] = dictionaryFiles.split(",");
 InputStream affix = null;
 List<InputStream> dictionaries = new ArrayList<>();
 try {
  dictionaries = new ArrayList<>();
  for (String file : dicts) {
   dictionaries.add(loader.openResource(file));
  }
  affix = loader.openResource(affixFile);
  Path tempPath = Files.createTempDirectory(Dictionary.getDefaultTempDir(), "Hunspell");
  try (Directory tempDir = FSDirectory.open(tempPath)) {
   this.dictionary = new Dictionary(tempDir, "hunspell", affix, dictionaries, ignoreCase);
  } finally {
   IOUtils.rm(tempPath); 
  }
 } catch (ParseException e) {
  throw new IOException("Unable to load hunspell data! [dictionary=" + dictionaries + ",affix=" + affixFile + "]", e);
 } finally {
  IOUtils.closeWhileHandlingException(affix);
  IOUtils.closeWhileHandlingException(dictionaries);
 }
}
origin: org.elasticsearch/elasticsearch

return new Dictionary(tmp, "hunspell", affixStream, dicStreams, ignoreCase);
origin: omegat-org/omegat

private static Dictionary initDict(Language language) {
  populateInstalledDicts();
  File affixFile;
  File dictionaryFile;
  synchronized (HunspellTokenizer.class) {
    affixFile = affixFiles.get(language);
    dictionaryFile = dictionaryFiles.get(language);
  }
  if (affixFile == null || dictionaryFile == null || !affixFile.exists() || !dictionaryFile.exists()) {
    Log.logErrorRB("HUNSPELL_TOKENIZER_DICT_NOT_INSTALLED", language.getLocale());
    return null;
  }
  try {
    return new Dictionary(new FileInputStream(affixFile), new FileInputStream(dictionaryFile));
  } catch (Throwable t) {
    Log.log(t);
    return null;
  }
}
origin: org.infinispan/infinispan-embedded-query

@Override
public void inform(ResourceLoader loader) throws IOException {
 String dicts[] = dictionaryFiles.split(",");
 InputStream affix = null;
 List<InputStream> dictionaries = new ArrayList<>();
 try {
  dictionaries = new ArrayList<>();
  for (String file : dicts) {
   dictionaries.add(loader.openResource(file));
  }
  affix = loader.openResource(affixFile);
  this.dictionary = new Dictionary(affix, dictionaries, ignoreCase);
 } catch (ParseException e) {
  throw new IOException("Unable to load hunspell data! [dictionary=" + dictionaries + ",affix=" + affixFile + "]", e);
 } finally {
  IOUtils.closeWhileHandlingException(affix);
  IOUtils.closeWhileHandlingException(dictionaries);
 }
}
origin: com.scireum/sirius-nlp-main

/**
 * Loads a german hunspell dictionary.
 *
 * @return a german hunspell dictionary
 */
public static Dictionary getGermanHunspellDict() {
  List<InputStream> dictionaries = new ArrayList<>();
  InputStream affix = null;
  try {
    dictionaries = new ArrayList<>();
    dictionaries.add(RessourceLoading.class.getResourceAsStream(HUNSPELL_PATH + ".dic"));
    affix = RessourceLoading.class.getResourceAsStream(HUNSPELL_PATH + ".aff");
    Path tempPath = Files.createTempDirectory(Paths.get(System.getProperty("java.io.tmpdir")), "Hunspell");
    try (Directory tempDir = FSDirectory.open(tempPath)) {
      return new Dictionary(tempDir, "hunspell", affix, dictionaries, true);
    } finally {
      IOUtils.rm(tempPath);
    }
  } catch (ParseException | IOException e) {
    throw new ElasticsearchException(e);
  } finally {
    IOUtils.closeWhileHandlingException(affix);
    IOUtils.closeWhileHandlingException(dictionaries);
  }
}
origin: com.strapdata.elasticsearch/elasticsearch

return new Dictionary(tmp, "hunspell", affixStream, dicStreams, ignoreCase);
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

return new Dictionary(tmp, "hunspell", affixStream, dicStreams, ignoreCase);
origin: apache/servicemix-bundles

return new Dictionary(tmp, "hunspell", affixStream, dicStreams, ignoreCase);
org.apache.lucene.analysis.hunspellDictionary<init>

Javadoc

Creates a new Dictionary containing the information read from the provided InputStreams to hunspell affix and dictionary files. You have to close the provided InputStreams yourself.

Popular methods of Dictionary

  • affixFST
  • applyMappings
  • caseFold
    folds single character (according to LANG if present)
  • cleanInput
  • decodeFlags
  • encodeFlags
  • escapeDash
  • getAliasValue
  • getDictionaryEncoding
    Parses the encoding specified in the affix file readable through the provided InputStream
  • getFlagParsingStrategy
    Determines the appropriate FlagParsingStrategy based on the FLAG definition line taken from the affi
  • getJavaEncoding
    Retrieves the CharsetDecoder for the given encoding. Note, This isn't perfect as I think ISCII-DEVAN
  • getStemException
  • getJavaEncoding,
  • getStemException,
  • hasFlag,
  • indexOfSpaceOrTab,
  • lookup,
  • lookupWord,
  • morphBoundary,
  • parseAffix,
  • parseAlias

Popular in Java

  • Making http post requests using okhttp
  • setRequestProperty (URLConnection)
  • notifyDataSetChanged (ArrayAdapter)
  • getResourceAsStream (ClassLoader)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now