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


Java AttributeSource.copyTo方法代码示例

本文整理汇总了Java中org.apache.lucene.util.AttributeSource.copyTo方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeSource.copyTo方法的具体用法?Java AttributeSource.copyTo怎么用?Java AttributeSource.copyTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.util.AttributeSource的用法示例。


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

示例1: incrementToken

import org.apache.lucene.util.AttributeSource; //导入方法依赖的package包/类
@Override
public final boolean incrementToken() throws IOException {
    clearAttributes();
    if (first) {
        String[] words = walkTokens();
        if (words.length == 0) {
            return false;
        }
        createTags(words);
        first = false;
        indexToken = 0;
    }
    if (indexToken == tokenAttrs.size()) {
        return false;
    }
    AttributeSource as = tokenAttrs.get(indexToken);
    Iterator<? extends Class<? extends Attribute>> it = as.getAttributeClassesIterator();
    while (it.hasNext()) {
        Class<? extends Attribute> attrClass = it.next();
        if (!hasAttribute(attrClass)) {
            addAttribute(attrClass);
        }
    }
    as.copyTo(this);
    indexToken++;
    return true;
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-opennlp,代码行数:28,代码来源:OpenNLPTokenFilter.java

示例2: incrementToken

import org.apache.lucene.util.AttributeSource; //导入方法依赖的package包/类
@Override
public boolean incrementToken() {
  if (tokenIterator.hasNext()) {
    clearAttributes();
    AttributeSource next = tokenIterator.next();
    Iterator<Class<? extends Attribute>> atts = next.getAttributeClassesIterator();
    while (atts.hasNext()) // make sure all att impls in the token exist here
      addAttribute(atts.next());
    next.copyTo(this);
    return true;
  } else {
    return false;
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:AnalysisRequestHandlerBase.java

示例3: incrementToken

import org.apache.lucene.util.AttributeSource; //导入方法依赖的package包/类
@Override
public final boolean incrementToken() throws IOException {
	if (tokenQueue.size() > 0) {
		tokenQueue.remove(0).copyTo(this);
		return true;
	}
	if (endOfInput == false && input.incrementToken()) {
		if (termAtt.toString().equals("dogs")) {
			addSynonymAndRestoreOrigToken("dog", 1, offsetAtt.endOffset());
		} else if (termAtt.toString().equals("guinea")) {
			AttributeSource firstSavedToken = cloneAttributes();
			if (input.incrementToken()) {
				if (termAtt.toString().equals("pig")) {
					AttributeSource secondSavedToken = cloneAttributes();
					int secondEndOffset = offsetAtt.endOffset();
					firstSavedToken.copyTo(this);
					addSynonym("cavy", 2, secondEndOffset);
					tokenQueue.add(secondSavedToken);
				} else if (termAtt.toString().equals("dogs")) {
					tokenQueue.add(cloneAttributes());
					addSynonym("dog", 1, offsetAtt.endOffset());
				}
			} else {
				endOfInput = true;
			}
			firstSavedToken.copyTo(this);
		}
		return true;
	} else {
		endOfInput = true;
		return false;
	}
}
 
开发者ID:easynet-cn,项目名称:resource-query-parser,代码行数:34,代码来源:MockSynonymFilter.java

示例4: incrementToken

import org.apache.lucene.util.AttributeSource; //导入方法依赖的package包/类
@Override
public boolean incrementToken() throws IOException {
    //clearAttributes();
    if (first) {
        //gather all tokens from doc
        String[] words = walkTokens();
        if (words.length == 0) {
            return false;
        }
        //tagging
        posTags = createTags(words);
        first = false;
        tokenIdx = 0;
    }

    if (tokenIdx == tokenAttrs.size()) {
        resetParams();
        return false;
    }

    AttributeSource as = tokenAttrs.get(tokenIdx);
    Iterator<? extends Class<? extends Attribute>> it = as.getAttributeClassesIterator();
    while (it.hasNext()) {
        Class<? extends Attribute> attrClass = it.next();
        if (!hasAttribute(attrClass)) {
            addAttribute(attrClass);
        }
    }
    as.copyTo(this);
    MWEMetadata metadata = exitingPayload.getPayload() == null ? new MWEMetadata() :
            MWEMetadata.deserialize(exitingPayload.getPayload().utf8ToString());
    metadata.addMetaData(MWEMetadataType.POS, posTags[tokenIdx]);
    exitingPayload.setPayload(new BytesRef(MWEMetadata.serialize(metadata)));
    tokenIdx++;
    return true;
}
 
开发者ID:ziqizhang,项目名称:jate,代码行数:37,代码来源:OpenNLPPOSTaggerFilter.java

示例5: copy

import org.apache.lucene.util.AttributeSource; //导入方法依赖的package包/类
private void copy(AttributeSource target, AttributeSource source) {
  if (target != source)
    source.copyTo(target);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:SlowSynonymFilter.java

示例6: addSynonymAndRestoreOrigToken

import org.apache.lucene.util.AttributeSource; //导入方法依赖的package包/类
private void addSynonymAndRestoreOrigToken(String synonymText, int posLen, int endOffset) {
	AttributeSource origToken = cloneAttributes();
	addSynonym(synonymText, posLen, endOffset);
	origToken.copyTo(this);
}
 
开发者ID:easynet-cn,项目名称:resource-query-parser,代码行数:6,代码来源:MockSynonymFilter.java


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