Java 类org.apache.lucene.analysis.WordlistLoader 实例源码

项目:analyzers-ja    文件:ReloadableStopFilter.java   
private void loadStopWordSet() {
    try (BufferedReader reader = Files.newBufferedReader(stopWordPath, Charset.forName("UTF-8"))) {
        stopWords = WordlistLoader.getWordSet(reader, new CharArraySet(INITIAL_CAPACITY, ignoreCase));
        lastModifed = Files.getLastModifiedTime(stopWordPath).toMillis();
    } catch (Exception e) {
        throw new IllegalArgumentException("Failed to read " + stopWordPath, e);
    }
}
项目:analyzers-ja    文件:ReloadableKeywordMarkerFilter.java   
private void loadKeywordSet() {
    try (BufferedReader reader = Files.newBufferedReader(keywordPath, Charset.forName("UTF-8"))) {
        keywordSet = WordlistLoader.getWordSet(reader);
        lastModifed = Files.getLastModifiedTime(keywordPath).toMillis();
    } catch (Exception e) {
        throw new IllegalArgumentException("Failed to read " + keywordPath, e);
    }
}
项目:ExpertFinder    文件:GermanAnalyzer.java   
/**
 * Builds an analyzer with the given stop words.
 */
public GermanAnalyzer(File stopwords) throws IOException {
  stopSet = WordlistLoader.getWordSet(stopwords);
}
项目:ExpertFinder    文件:GermanAnalyzer.java   
/**
 * Builds an exclusionlist from the words contained in the given file.
 */
public void setStemExclusionTable(File exclusionlist) throws IOException {
  exclusionSet = WordlistLoader.getWordSet(exclusionlist);
}
项目:elasticsearch-plugin-bundle    文件:AutoPhrasingTokenFilterFactory.java   
private List<String> getLines(ResourceLoader loader, String resource) throws IOException {
    return WordlistLoader.getLines(loader.openResource(resource), StandardCharsets.UTF_8);
}
项目:ansj-seg-for-lucene3    文件:StopwordsUtil.java   
/**
 * Creates a CharArraySet from a file.
 * 
 * @param stopwords
 *            the stopwords file to load
 * 
 * @param matchVersion
 *            the Lucene version for cross version compatibility
 * @return a CharArraySet containing the distinct stopwords from the given
 *         file
 * @throws IOException
 *             if loading the stopwords throws an {@link IOException}
 */
public static CharArraySet loadStopwordSet(File stopwords,
        Version matchVersion) throws IOException {
    Reader reader = null;
    try {
        reader = IOUtils.getDecodingReader(stopwords, IOUtils.CHARSET_UTF_8);
        return WordlistLoader.getWordSet(reader, matchVersion);
    } finally {
        IOUtils.close(reader);
    }
}
项目:ansj-seg-for-lucene3    文件:StopwordsUtil.java   
/**
 * Creates a CharArraySet from a file.
 * 
 * @param stopwords
 *            the stopwords reader to load
 * 
 * @param matchVersion
 *            the Lucene version for cross version compatibility
 * @return a CharArraySet containing the distinct stopwords from the given
 *         reader
 * @throws IOException
 *             if loading the stopwords throws an {@link IOException}
 */
public static CharArraySet loadStopwordSet(Reader stopwords,
        Version matchVersion) throws IOException {
    try {
        return WordlistLoader.getWordSet(stopwords, matchVersion);
    } finally {
        IOUtils.close(stopwords);
    }
}
项目:OCRaptor    文件:StandardAnalyzer.java   
/**
 * Builds an analyzer with the stop words from the given file.
 *
 * @see WordlistLoader#getWordSet(Reader, Version)
 * @param matchVersion
 *          Lucene version to match See {@link <a href="#version">above</a>}
 * @param stopwords
 *          File to read stop words from
 * @deprecated Use {@link #StandardAnalyzer(Version, Reader)} instead.
 */
@Deprecated
public StandardAnalyzer(Version matchVersion, File stopwords) throws IOException {
  this(matchVersion, WordlistLoader.getWordSet(IOUtils.getDecodingReader(stopwords,
      IOUtils.CHARSET_UTF_8), matchVersion));
}
项目:OCRaptor    文件:StandardAnalyzer.java   
/**
 * Builds an analyzer with the stop words from the given reader.
 *
 * @see WordlistLoader#getWordSet(Reader, Version)
 * @param matchVersion
 *          Lucene version to match See {@link <a href="#version">above</a>}
 * @param stopwords
 *          Reader to read stop words from
 */
public StandardAnalyzer(Version matchVersion, Reader stopwords) throws IOException {
  this(matchVersion, WordlistLoader.getWordSet(stopwords, matchVersion));
}
项目:dash-xtf    文件:SpellWritingAnalyzer.java   
/**
 * Builds an analyzer which writes to the given spelling dictionary, using the
 * stop words from the given file.
 * 
 * @see WordlistLoader#getWordSet(File)
 */
public SpellWritingAnalyzer(File stopwords, SpellWriter spellWriter)
    throws IOException
{
  this(WordlistLoader.getWordSet(stopwords), spellWriter);
}
项目:dash-xtf    文件:SpellWritingAnalyzer.java   
/**
 * Builds an analyzer which writes to the given spelling dictionary, using the
 * stop words from the given reader.
 * 
 * @see WordlistLoader#getWordSet(Reader)
 */
public SpellWritingAnalyzer(Reader stopwords, SpellWriter spellWriter)
    throws IOException
{
  this(WordlistLoader.getWordSet(stopwords), spellWriter);
}
项目:projectforge-webapp    文件:ClassicAnalyzer.java   
/** Builds an analyzer with the stop words from the given file.
 * @see WordlistLoader#getWordSet(File)
 * @param matchVersion Lucene version to match See {@link
 * <a href="#version">above</a>}
 * @param stopwords File to read stop words from */
public ClassicAnalyzer(final Version matchVersion, final File stopwords) throws IOException {
  this(matchVersion, WordlistLoader.getWordSet(stopwords));
}
项目:projectforge-webapp    文件:ClassicAnalyzer.java   
/** Builds an analyzer with the stop words from the given reader.
 * @see WordlistLoader#getWordSet(Reader)
 * @param matchVersion Lucene version to match See {@link
 * <a href="#version">above</a>}
 * @param stopwords Reader to read stop words from */
public ClassicAnalyzer(final Version matchVersion, final Reader stopwords) throws IOException {
  this(matchVersion, WordlistLoader.getWordSet(stopwords));
}
项目:projectforge-webapp    文件:StandardAnalyzer.java   
/** Builds an analyzer with the stop words from the given file.
 * @see WordlistLoader#getWordSet(File)
 * @param matchVersion Lucene version to match See {@link
 * <a href="#version">above</a>}
 * @param stopwords File to read stop words from */
public StandardAnalyzer(final Version matchVersion, final File stopwords) throws IOException {
  this(matchVersion, WordlistLoader.getWordSet(stopwords));
}
项目:projectforge-webapp    文件:StandardAnalyzer.java   
/** Builds an analyzer with the stop words from the given reader.
 * @see WordlistLoader#getWordSet(Reader)
 * @param matchVersion Lucene version to match See {@link
 * <a href="#version">above</a>}
 * @param stopwords Reader to read stop words from */
public StandardAnalyzer(final Version matchVersion, final Reader stopwords) throws IOException {
  this(matchVersion, WordlistLoader.getWordSet(stopwords));
}