本文整理汇总了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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例5: copy
import org.apache.lucene.util.AttributeSource; //导入方法依赖的package包/类
private void copy(AttributeSource target, AttributeSource source) {
if (target != source)
source.copyTo(target);
}
示例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);
}