当前位置: 首页>>代码示例>>Java>>正文


Java PorterStemFilter类代码示例

本文整理汇总了Java中org.apache.lucene.analysis.PorterStemFilter的典型用法代码示例。如果您正苦于以下问题:Java PorterStemFilter类的具体用法?Java PorterStemFilter怎么用?Java PorterStemFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PorterStemFilter类属于org.apache.lucene.analysis包,在下文中一共展示了PorterStemFilter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reusableTokenStream

import org.apache.lucene.analysis.PorterStemFilter; //导入依赖的package包/类
/**
 *
 * @param fieldName
 * @param reader
 * @return
 * @throws IOException
 */
@Override
public TokenStream reusableTokenStream(String fieldName, Reader reader) throws
        IOException {
    SavedStreams streams = (SavedStreams) getPreviousTokenStream();
    if (streams == null) {
        streams = new SavedStreams();
        streams.source = new WhitespaceTokenizer(reader);
        streams.result = new StopFilter(true, streams.source, stopwords, true);
        streams.result = new PorterStemFilter(streams.source);

        setPreviousTokenStream(streams);
    } else {
        streams.source.reset(reader);
    }
    return streams.result;
}
 
开发者ID:jcrcano,项目名称:DrakkarKeel,代码行数:24,代码来源:StopStemAnalyzerCaseSensitive.java

示例2: tokenStream

import org.apache.lucene.analysis.PorterStemFilter; //导入依赖的package包/类
@Override
public final TokenStream tokenStream(String fieldName, Reader reader) {
    // Apply stop words and porter stemmer using a lower-case tokenizer.
    TokenStream stream = new StopFilter(new LowerCaseTokenizer(reader),
        StandardAnalyzer.STOP_WORDS);
    return new PorterStemFilter(stream);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:8,代码来源:WordMatchRouter.java

示例3: tokenStream

import org.apache.lucene.analysis.PorterStemFilter; //导入依赖的package包/类
@Override
public final TokenStream tokenStream(String fieldName, Reader reader) {
          // Apply stop words and porter stemmer using a lower-case tokenizer.
          TokenStream stream = new StopFilter(new LowerCaseTokenizer(reader),
              StandardAnalyzer.STOP_WORDS);
          return new PorterStemFilter(stream);
      }
 
开发者ID:coodeer,项目名称:g3server,代码行数:8,代码来源:WordMatchRouter.java

示例4: tokenizeGloss

import org.apache.lucene.analysis.PorterStemFilter; //导入依赖的package包/类
/**
    * Takes a gloss-like string (text) and returns it tokenized.
    * with:
    * - stopwords
    * - lower case
    * - porter stemmer
    */
   protected Set<String> tokenizeGloss( String s ) throws IOException {
Set<String> result = new HashSet<String>();
// I am affraid that I am reimplementing the StandardAnalizer...
TokenStream ts = new PorterStemFilter(
			new StopFilter( true, 
                                      new LowerCaseTokenizer( 
                                             new StringReader( s ) ), stopWords, true ));
TermAttribute termAtt = ts.addAttribute(TermAttribute.class);
while ( ts.incrementToken() ) {
    result.add( termAtt.term() );
}
return result;
   }
 
开发者ID:dozed,项目名称:align-api-project,代码行数:21,代码来源:JWNLDistances.java


注:本文中的org.apache.lucene.analysis.PorterStemFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。