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

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

本文整理了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

  1. /**
  2. * Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared.
  3. * @param prototype existing Token
  4. * @param newTerm new term text
  5. */
  6. public void reinit(Token prototype, String newTerm) {
  7. setEmpty().append(newTerm);
  8. positionIncrement = prototype.positionIncrement;
  9. flags = prototype.flags;
  10. startOffset = prototype.startOffset;
  11. endOffset = prototype.endOffset;
  12. type = prototype.type;
  13. payload = prototype.payload;
  14. }

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

  1. void addToken(float score) {
  2. if (numTokens < MAX_NUM_TOKENS_PER_GROUP) {
  3. int termStartOffset = offsetAtt.startOffset();
  4. int termEndOffset = offsetAtt.endOffset();
  5. if (numTokens == 0) {
  6. startOffset = matchStartOffset = termStartOffset;
  7. endOffset = matchEndOffset = termEndOffset;
  8. tot += score;
  9. } else {
  10. startOffset = Math.min(startOffset, termStartOffset);
  11. endOffset = Math.max(endOffset, termEndOffset);
  12. if (score > 0) {
  13. if (tot == 0) {
  14. matchStartOffset = offsetAtt.startOffset();
  15. matchEndOffset = offsetAtt.endOffset();
  16. } else {
  17. matchStartOffset = Math.min(matchStartOffset, termStartOffset);
  18. matchEndOffset = Math.max(matchEndOffset, termEndOffset);
  19. }
  20. tot += score;
  21. }
  22. }
  23. Token token = new Token(termStartOffset, termEndOffset);
  24. token.setEmpty().append(termAtt);
  25. tokens[numTokens] = token;
  26. scores[numTokens] = score;
  27. numTokens++;
  28. }
  29. }

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

  1. void addToken(float score) {
  2. if (numTokens < MAX_NUM_TOKENS_PER_GROUP) {
  3. int termStartOffset = offsetAtt.startOffset();
  4. int termEndOffset = offsetAtt.endOffset();
  5. if (numTokens == 0) {
  6. startOffset = matchStartOffset = termStartOffset;
  7. endOffset = matchEndOffset = termEndOffset;
  8. tot += score;
  9. } else {
  10. startOffset = Math.min(startOffset, termStartOffset);
  11. endOffset = Math.max(endOffset, termEndOffset);
  12. if (score > 0) {
  13. if (tot == 0) {
  14. matchStartOffset = offsetAtt.startOffset();
  15. matchEndOffset = offsetAtt.endOffset();
  16. } else {
  17. matchStartOffset = Math.min(matchStartOffset, termStartOffset);
  18. matchEndOffset = Math.max(matchEndOffset, termEndOffset);
  19. }
  20. tot += score;
  21. }
  22. }
  23. Token token = new Token(termStartOffset, termEndOffset);
  24. token.setEmpty().append(termAtt);
  25. tokens[numTokens] = token;
  26. scores[numTokens] = score;
  27. numTokens++;
  28. }
  29. }

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

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

相关文章