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

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

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

Token.setTermBuffer介绍

[英]Copies the contents of buffer into the termBuffer array.
[中]将缓冲区的内容复制到termBuffer数组中。

代码示例

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/**
 * Fills Lucene token with the current token text.
 */
final void getText(Token t) {
 t.setTermBuffer(zzBuffer, zzStartRead, zzMarkedPos-zzStartRead);
}

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

/**
 * Fills Lucene token with the current token text.
 */
final void getText(Token t) {
 t.setTermBuffer(zzBuffer, zzStartRead, zzMarkedPos-zzStartRead);
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

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

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

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

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

/**
 *  Constructs a Token with the given term buffer (offset
 *  & length), start and end
 *  offsets
 * @param startTermBuffer
 * @param termBufferOffset
 * @param termBufferLength
 * @param start
 * @param end
 */
public Token(char[] startTermBuffer, int termBufferOffset, int termBufferLength, int start, int end) {
 setTermBuffer(startTermBuffer, termBufferOffset, termBufferLength);
 startOffset = start;
 endOffset = end;
}

代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core

/** Produces a List<Token> from a List<String> */
public static List<Token> makeTokens(List<String> strings) {
 List<Token> ret = new ArrayList<Token>(strings.size());
 for (String str : strings) {
  //Token newTok = new Token(str,0,0,"SYNONYM");
  Token newTok = new Token(0,0,"SYNONYM");
  newTok.setTermBuffer(str.toCharArray(), 0, str.length());
  ret.add(newTok);
 }
 return ret;
}

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

/** Shorthand for calling {@link #clear},
 *  {@link #setTermBuffer(String)},
 *  {@link #setStartOffset},
 *  {@link #setEndOffset}
 *  {@link #setType}
 *  @return this Token instance */
public Token reinit(String newTerm, int newStartOffset, int newEndOffset, String newType) {
 clearNoTermBuffer();
 setTermBuffer(newTerm);
 startOffset = newStartOffset;
 endOffset = newEndOffset;
 type = newType;
 return this;
}

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

/**
 * Copy the prototype token's fields into this one. Note: Payloads are shared.
 * @param prototype
 */
public void reinit(Token prototype) {
 prototype.initTermBuffer();
 setTermBuffer(prototype.termBuffer, 0, prototype.termLength);
 positionIncrement = prototype.positionIncrement;
 flags = prototype.flags;
 startOffset = prototype.startOffset;
 endOffset = prototype.endOffset;
 type = prototype.type;
 payload =  prototype.payload;
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/** Shorthand for calling {@link #clear},
 *  {@link #setTermBuffer(String)},
 *  {@link #setStartOffset},
 *  {@link #setEndOffset}
 *  {@link #setType}
 *  @return this Token instance */
public Token reinit(String newTerm, int newStartOffset, int newEndOffset, String newType) {
 clearNoTermBuffer();
 setTermBuffer(newTerm);
 startOffset = newStartOffset;
 endOffset = newEndOffset;
 type = newType;
 return this;
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/** Shorthand for calling {@link #clear},
 *  {@link #setTermBuffer(String, int, int)},
 *  {@link #setStartOffset},
 *  {@link #setEndOffset}
 *  {@link #setType}
 *  @return this Token instance */
public Token reinit(String newTerm, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) {
 clearNoTermBuffer();
 setTermBuffer(newTerm, newTermOffset, newTermLength);
 startOffset = newStartOffset;
 endOffset = newEndOffset;
 type = newType;
 return this;
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/** Shorthand for calling {@link #clear},
 *  {@link #setTermBuffer(String)},
 *  {@link #setStartOffset},
 *  {@link #setEndOffset}
 *  {@link #setType} on Token.DEFAULT_TYPE
 *  @return this Token instance */
public Token reinit(String newTerm, int newStartOffset, int newEndOffset) {
 clearNoTermBuffer();
 setTermBuffer(newTerm);
 startOffset = newStartOffset;
 endOffset = newEndOffset;
 type = DEFAULT_TYPE;
 return this;
}

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

/** Shorthand for calling {@link #clear},
 *  {@link #setTermBuffer(String, int, int)},
 *  {@link #setStartOffset},
 *  {@link #setEndOffset}
 *  {@link #setType}
 *  @return this Token instance */
public Token reinit(String newTerm, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) {
 clearNoTermBuffer();
 setTermBuffer(newTerm, newTermOffset, newTermLength);
 startOffset = newStartOffset;
 endOffset = newEndOffset;
 type = newType;
 return this;
}

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

/** Shorthand for calling {@link #clear},
 *  {@link #setTermBuffer(String)},
 *  {@link #setStartOffset},
 *  {@link #setEndOffset}
 *  {@link #setType} on Token.DEFAULT_TYPE
 *  @return this Token instance */
public Token reinit(String newTerm, int newStartOffset, int newEndOffset) {
 clearNoTermBuffer();
 setTermBuffer(newTerm);
 startOffset = newStartOffset;
 endOffset = newEndOffset;
 type = DEFAULT_TYPE;
 return this;
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/** Shorthand for calling {@link #clear},
 *  {@link #setTermBuffer(char[], int, int)},
 *  {@link #setStartOffset},
 *  {@link #setEndOffset},
 *  {@link #setType}
 *  @return this Token instance */
public Token reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) {
 clearNoTermBuffer();
 payload = null;
 positionIncrement = 1;
 setTermBuffer(newTermBuffer, newTermOffset, newTermLength);
 startOffset = newStartOffset;
 endOffset = newEndOffset;
 type = newType;
 return this;
}

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

/** Shorthand for calling {@link #clear},
 *  {@link #setTermBuffer(char[], int, int)},
 *  {@link #setStartOffset},
 *  {@link #setEndOffset},
 *  {@link #setType}
 *  @return this Token instance */
public Token reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) {
 clearNoTermBuffer();
 payload = null;
 positionIncrement = 1;
 setTermBuffer(newTermBuffer, newTermOffset, newTermLength);
 startOffset = newStartOffset;
 endOffset = newEndOffset;
 type = newType;
 return this;
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/** Shorthand for calling {@link #clear},
 *  {@link #setTermBuffer(char[], int, int)},
 *  {@link #setStartOffset},
 *  {@link #setEndOffset}
 *  {@link #setType} on Token.DEFAULT_TYPE
 *  @return this Token instance */
public Token reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) {
 clearNoTermBuffer();
 setTermBuffer(newTermBuffer, newTermOffset, newTermLength);
 startOffset = newStartOffset;
 endOffset = newEndOffset;
 type = DEFAULT_TYPE;
 return this;
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/** Shorthand for calling {@link #clear},
 *  {@link #setTermBuffer(String, int, int)},
 *  {@link #setStartOffset},
 *  {@link #setEndOffset}
 *  {@link #setType} on Token.DEFAULT_TYPE
 *  @return this Token instance */
public Token reinit(String newTerm, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) {
 clearNoTermBuffer();
 setTermBuffer(newTerm, newTermOffset, newTermLength);
 startOffset = newStartOffset;
 endOffset = newEndOffset;
 type = DEFAULT_TYPE;
 return this;
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/**
 * Copy the prototype token's fields into this one. Note: Payloads are shared.
 * @param prototype
 */
public void reinit(Token prototype) {
 prototype.initTermBuffer();
 setTermBuffer(prototype.termBuffer, 0, prototype.termLength);
 positionIncrement = prototype.positionIncrement;
 flags = prototype.flags;
 startOffset = prototype.startOffset;
 endOffset = prototype.endOffset;
 type = prototype.type;
 payload =  prototype.payload;
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

public final Token next(final Token reusableToken) throws IOException {
  assert reusableToken != null;
  Token nextToken = input.next(reusableToken);
  if (nextToken == null)
   return null;

  if (stemmer.stem(nextToken.termBuffer(), 0, nextToken.termLength()))
   nextToken.setTermBuffer(stemmer.getResultBuffer(), 0, stemmer.getResultLength());
  return nextToken;
 }
}

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

public final Token next(final Token reusableToken) throws IOException {
  assert reusableToken != null;
  Token nextToken = input.next(reusableToken);
  if (nextToken == null)
   return null;

  if (stemmer.stem(nextToken.termBuffer(), 0, nextToken.termLength()))
   nextToken.setTermBuffer(stemmer.getResultBuffer(), 0, stemmer.getResultLength());
  return nextToken;
 }
}

相关文章