List of usage examples for org.apache.lucene.analysis.ja.dict UserDictionary UserDictionary
private UserDictionary(List<String[]> featureEntries) throws IOException
From source file:org.apache.solr.analysis.JapaneseTokenizerFactory.java
License:Apache License
@Override public void inform(ResourceLoader loader) { mode = getMode(args);/* w w w .ja va 2 s . c om*/ String userDictionaryPath = args.get(USER_DICT_PATH); try { if (userDictionaryPath != null) { InputStream stream = loader.openResource(userDictionaryPath); String encoding = args.get(USER_DICT_ENCODING); if (encoding == null) { encoding = IOUtils.UTF_8; } CharsetDecoder decoder = Charset.forName(encoding).newDecoder() .onMalformedInput(CodingErrorAction.REPORT).onUnmappableCharacter(CodingErrorAction.REPORT); Reader reader = new InputStreamReader(stream, decoder); userDictionary = new UserDictionary(reader); } else { userDictionary = null; } } catch (Exception e) { throw new InitializationException("Exception thrown while loading dictionary", e); } }