org.apache.lucene.analysis.Token.setEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中org.apache.lucene.analysis.Token.setEmpty()方法的一些代码示例,展示了Token.setEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Token.setEmpty()方法的具体详情如下:
包路径:org.apache.lucene.analysis.Token
类名称:Token
方法名:setEmpty

Token.setEmpty介绍

暂无

代码示例

代码示例来源:origin: gncloud/fastcatsearch

/**
 * Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared.
 * @param prototype existing Token
 * @param newTerm new term text
 */
public void reinit(Token prototype, String newTerm) {
 setEmpty().append(newTerm);
 positionIncrement = prototype.positionIncrement;
 flags = prototype.flags;
 startOffset = prototype.startOffset;
 endOffset = prototype.endOffset;
 type = prototype.type;
 payload =  prototype.payload;
}

代码示例来源:origin: msokolov/lux

void addToken(float score) {
 if (numTokens < MAX_NUM_TOKENS_PER_GROUP) {
  int termStartOffset = offsetAtt.startOffset();
  int termEndOffset = offsetAtt.endOffset();
  if (numTokens == 0) {
   startOffset = matchStartOffset = termStartOffset;
   endOffset = matchEndOffset = termEndOffset;
   tot += score;
  } else {
   startOffset = Math.min(startOffset, termStartOffset);
   endOffset = Math.max(endOffset, termEndOffset);
   if (score > 0) {
    if (tot == 0) {
     matchStartOffset = offsetAtt.startOffset();
     matchEndOffset = offsetAtt.endOffset();
    } else {
     matchStartOffset = Math.min(matchStartOffset, termStartOffset);
     matchEndOffset = Math.max(matchEndOffset, termEndOffset);
    }
    tot += score;
   }
  }
  Token token = new Token(termStartOffset, termEndOffset);
  token.setEmpty().append(termAtt);
  tokens[numTokens] = token;
  scores[numTokens] = score;
  numTokens++;
 }
}

代码示例来源:origin: gncloud/fastcatsearch

void addToken(float score) {
 if (numTokens < MAX_NUM_TOKENS_PER_GROUP) {
  int termStartOffset = offsetAtt.startOffset();
  int termEndOffset = offsetAtt.endOffset();
  if (numTokens == 0) {
   startOffset = matchStartOffset = termStartOffset;
   endOffset = matchEndOffset = termEndOffset;
   tot += score;
  } else {
   startOffset = Math.min(startOffset, termStartOffset);
   endOffset = Math.max(endOffset, termEndOffset);
   if (score > 0) {
    if (tot == 0) {
     matchStartOffset = offsetAtt.startOffset();
     matchEndOffset = offsetAtt.endOffset();
    } else {
     matchStartOffset = Math.min(matchStartOffset, termStartOffset);
     matchEndOffset = Math.max(matchEndOffset, termEndOffset);
    }
    tot += score;
   }
  }
  Token token = new Token(termStartOffset, termEndOffset);
  token.setEmpty().append(termAtt);
  tokens[numTokens] = token;
  scores[numTokens] = score;
  numTokens++;
 }
}

代码示例来源:origin: org.apache.lucene/lucene-analyzers

reusableToken.setEmpty().append(sb);
updateToken(reusableToken, shingle, currentPermutationTokensStartOffset, currentPermutationRows, currentPermuationTokens);

相关文章