Lucene - Token
Token representa el texto o la palabra en un documento con detalles relevantes como sus metadatos (posición, desplazamiento inicial, desplazamiento final, tipo de token y su incremento de posición).
Declaración de clase
A continuación se muestra la declaración de org.apache.lucene.analysis.Token clase:
public class Token
extends TermAttributeImpl
implements TypeAttribute, PositionIncrementAttribute,
FlagsAttribute, OffsetAttribute,
PayloadAttribute, PositionLengthAttribute
Campos
A continuación se muestran los campos para org.apache.lucene.analysis.Token clase -
static AttributeSource.AttributeFactory TOKEN_ATTRIBUTE_FACTORY - Fábrica de conveniencia que devuelve Token como implementación para los atributos básicos y devuelve el impl predeterminado (con "Impl" adjunto) para todos los demás atributos.
Constructores de clases
La siguiente tabla muestra los diferentes constructores de clases:
S.No. | Constructor y descripción |
---|---|
1 | Token() Construye un Token anulará el texto. |
2 | Token(char[] startTermBuffer, int termBufferOffset, int termBufferLength, int start, int end) Construye un Token con el búfer de término dado (desplazamiento y longitud), compensaciones de inicio y final |
3 | Token(int start, int end) Construye un Token con texto nulo y compensaciones de inicio y finalización. |
4 | Constructs a Token with null text and start & end offsets plus flags. |
5 | Constructs a Token with null text and start/ end offsets plus the Token type. |
6 | Token(String text, int start, int end) Construye un Token con el texto del término dado y compensaciones de inicio / fin. |
7 | Token(String text, int start, int end, int flags) Construye un Token con el texto, las compensaciones de inicio / final y el tipo. |
8 | Token(String text, int start, int end, String typ) Construye un Token con el texto, las compensaciones de inicio / final y el tipo. |
Métodos de clase
La siguiente tabla muestra los diferentes métodos de clase:
S.No. | Método y descripción |
---|---|
1 | void clear() Restablece el término text, payload, flags y positionIncrement, startOffset, endOffset y el tipo de token a los valores predeterminados. |
2 | Object clone() Este es un clon superficial. |
3 | Token clone(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) Hace un clon, pero reemplaza el término buffer & start / end offset en el proceso. |
4 | void copyTo(AttributeImpl target) Copia los valores de este atributo en el atributo de destino pasado. |
5 | int endOffset() Devuelve el desplazamiento final del Token; uno mayor que la posición del último carácter correspondiente a este token en el texto fuente. |
6 | boolean equals(Object obj) |
7 | int getFlags() Obtiene el conjunto de bits de los bits que se han establecido. |
8 | Payload getPayload() Devuelve la carga útil de este token. |
9 | int getPositionIncrement() Devuelve el incremento de posición de este Token. |
10 | int getPositionLength() Obtenga la longitud de la posición. |
11 | int hashCode() |
12 | void reflectWith(AttributeReflector reflector) Este método es para la introspección de atributos, simplemente debe agregar la clave / valores que este atributo tiene al AttributeReflector dado. |
13 | Token reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) Abreviatura para llamar a clear (), CharTermAttributeImpl.copyBuffer (char [], int, int), setStartOffset (int), setEndOffset (int) setType (java.lang.String) en Token.DEFAULT_TYPE |
14 | Token reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) Abreviatura para llamar a clear (), CharTermAttributeImpl.copyBuffer (char [], int, int), setStartOffset (int), setEndOffset (int), setType (java.lang.String) |
15 | Token reinit(String newTerm, int newStartOffset, int newEndOffset) Abreviatura para llamar a clear (), CharTermAttributeImpl.append (CharSequence), setStartOffset (int), setEndOffset (int) setType (java.lang.String) en Token.DEFAULT_TYPE |
dieciséis | Token reinit(String newTerm, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) Abreviatura para llamar a clear (), CharTermAttributeImpl.append (CharSequence, int, int), setStartOffset (int), setEndOffset (int) setType (java.lang.String) en Token.DEFAULT_TYPE |
17 | Token reinit(String newTerm, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) Abreviatura para llamar a clear (), CharTermAttributeImpl.append (CharSequence, int, int), setStartOffset (int), setEndOffset (int) setType (java.lang.String) |
18 | Token reinit(String newTerm, int newStartOffset, int newEndOffset, String newType) Abreviatura para llamar a clear (), CharTermAttributeImpl.append (CharSequence), setStartOffset (int), setEndOffset (int) setType (java.lang.String) |
19 | void reinit(Token prototype) Copia los campos del token prototipo en este. |
20 | void reinit(Token prototype, char[] newTermBuffer, int offset, int length) Copia los campos del token prototipo en este, con un término diferente. |
21 | void reinit(Token prototype, String newTerm) Copia los campos del token prototipo en este, con un término diferente. |
22 | void setEndOffset(int offset) Establece el desplazamiento final. |
23 | void setFlags(int flags) |
24 | void setOffset(int startOffset, int endOffset) Establece el desplazamiento inicial y final. |
25 | void setPayload(Payload payload) Establece la carga útil de este token. |
26 | void setPositionIncrement(int positionIncrement) Establece el incremento de posición. |
27 | void setPositionLength(int positionLength) Establezca la longitud de la posición. |
28 | void setStartOffset(int offset) Establezca el desplazamiento inicial. |
29 | void setType(String type) Establece el tipo léxico. |
30 | int startOffset() Devuelve el desplazamiento inicial de este token, la posición del primer carácter correspondiente a este token en el texto fuente. |
31 | String type() Devuelve el tipo léxico de este Token. |
Métodos heredados
Esta clase hereda métodos de las siguientes clases:
- org.apache.lucene.analysis.tokenattributes.TermAttributeImpl
- org.apache.lucene.analysis.tokenattributes.CharTermAttributeImpl
- org.apache.lucene.util.AttributeImpl
- java.lang.Object