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


Java IndexAnalysis类代码示例

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


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

示例1: main

import org.ansj.splitWord.analysis.IndexAnalysis; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
	List<Term> parse = ToAnalysis.parse("中华人民 共和国 成立了 ");
	System.out.println(parse);
	List<Term> parse1 = IndexAnalysis.parse("你吃过饭了没有!!!!!吃过无妨论文");
	
  
	//System.out.println(parse1);
	String text11="ZW321282050000000325";
	
	Tokenizer tokenizer = new AnsjTokenizer(new StringReader(text11), 0, true);
	CharTermAttribute termAtt = tokenizer.addAttribute(CharTermAttribute.class);
	OffsetAttribute offsetAtt = 
			tokenizer.addAttribute(OffsetAttribute.class);
		PositionIncrementAttribute positionIncrementAtt = 
			tokenizer.addAttribute(PositionIncrementAttribute.class);

    tokenizer.reset();
	while (tokenizer.incrementToken()){

	      System.out.print(new String(termAtt.toString()+" ") );
		//  System.out.print( offsetAtt.startOffset() + "-" + offsetAtt.endOffset() + "-" );
		//System.out.print( positionIncrementAtt.getPositionIncrement() +"/");

	}
	tokenizer.close();
}
 
开发者ID:dimensoft,项目名称:improved-journey,代码行数:27,代码来源:TestAnsj.java

示例2: createComponents

import org.ansj.splitWord.analysis.IndexAnalysis; //导入依赖的package包/类
@Override
protected TokenStreamComponents createComponents(String fieldName,
		Reader reader) {
	final Tokenizer source = new AnsjTokenizer(reader,new IndexAnalysis(reader));
	
	TokenStreamComponents result;
	if (stopwords.isEmpty()) {
		result = new TokenStreamComponents(source);
	} else {
		result = new TokenStreamComponents(source,new StopFilter(matchVersion, source, stopwords));
	}
	
	return result;
}
 
开发者ID:flash0729,项目名称:ansj-seg-for-lucene3,代码行数:15,代码来源:AnsjIndexAnalyzer.java

示例3: AnsjAnalyzer

import org.ansj.splitWord.analysis.IndexAnalysis; //导入依赖的package包/类
/**
    * @param analysis 
    *            搜索时用精准分词,索引时用面向索引的分词,默认值为面向索引的分词
    */
public AnsjAnalyzer(final Version matchVersion, Class<? extends Analysis> analysis, final Set<?> stopwords) {
	this.matchVersion = matchVersion;
	this.analysis = analysis == null ? IndexAnalysis.class : analysis;
	// analyzers should use char array set for stopwords!
    this.stopwords = stopwords == null ? CharArraySet.EMPTY_SET : CharArraySet
        .unmodifiableSet(CharArraySet.copy(matchVersion, stopwords));
}
 
开发者ID:flash0729,项目名称:ansj-seg-for-lucene3,代码行数:12,代码来源:AnsjAnalyzer.java


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