Lucene - Token
Il token rappresenta il testo o la parola in un documento con dettagli rilevanti come i suoi metadati (posizione, offset iniziale, offset finale, tipo di token e incremento di posizione).
Dichiarazione di classe
Di seguito è riportata la dichiarazione per il org.apache.lucene.analysis.Token classe:
public class Token
extends TermAttributeImpl
implements TypeAttribute, PositionIncrementAttribute,
FlagsAttribute, OffsetAttribute,
PayloadAttribute, PositionLengthAttribute
Campi
Di seguito sono riportati i campi per org.apache.lucene.analysis.Token classe -
static AttributeSource.AttributeFactory TOKEN_ATTRIBUTE_FACTORY - Convenience factory che restituisce Token come implementazione per gli attributi di base e restituisce l'impl predefinito (con "Impl" aggiunto) per tutti gli altri attributi.
Costruttori di classi
La tabella seguente mostra i diversi costruttori di classi:
S.No. | Costruttore e descrizione |
---|---|
1 | Token() Costruisce un token con testo nullo. |
2 | Token(char[] startTermBuffer, int termBufferOffset, int termBufferLength, int start, int end) Costruisce un token con il termine buffer (offset e lunghezza), offset iniziale e finale specificato |
3 | Token(int start, int end) Costruisce un token con testo nullo e offset di inizio e fine. |
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) Costruisce un token con il testo del termine specificato e offset di inizio / fine. |
7 | Token(String text, int start, int end, int flags) Costruisce un token con il testo, gli offset di inizio / fine e il tipo dati. |
8 | Token(String text, int start, int end, String typ) Costruisce un token con il testo, gli offset di inizio / fine e il tipo dati. |
Metodi di classe
La tabella seguente mostra i diversi metodi di classe:
S.No. | Metodo e descrizione |
---|---|
1 | void clear() Reimposta il termine text, payload, flags e positionIncrement, startOffset, endOffset e il tipo di token sui valori predefiniti. |
2 | Object clone() Questo è un clone superficiale. |
3 | Token clone(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) Crea un clone, ma sostituisce il termine buffer e offset iniziale / finale nel processo. |
4 | void copyTo(AttributeImpl target) Copia i valori da questo attributo nell'attributo di destinazione passato. |
5 | int endOffset() Restituisce l'offset finale del token; uno maggiore della posizione dell'ultimo carattere corrispondente a questo token nel testo di partenza. |
6 | boolean equals(Object obj) |
7 | int getFlags() Ottiene il set di bit per tutti i bit che sono stati impostati. |
8 | Payload getPayload() Restituisce il payload di questo token. |
9 | int getPositionIncrement() Restituisce l'incremento di posizione di questo token. |
10 | int getPositionLength() Ottieni la lunghezza della posizione. |
11 | int hashCode() |
12 | void reflectWith(AttributeReflector reflector) Questo metodo è per l'introspezione degli attributi, dovrebbe semplicemente aggiungere la chiave / i valori che questo attributo detiene al dato AttributeReflector. |
13 | Token reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) Abbreviazione per chiamare clear (), CharTermAttributeImpl.copyBuffer (char [], int, int), setStartOffset (int), setEndOffset (int) setType (java.lang.String) su Token.DEFAULT_TYPE |
14 | Token reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) Abbreviazione per chiamare clear (), CharTermAttributeImpl.copyBuffer (char [], int, int), setStartOffset (int), setEndOffset (int), setType (java.lang.String) |
15 | Token reinit(String newTerm, int newStartOffset, int newEndOffset) Abbreviazione per chiamare clear (), CharTermAttributeImpl.append (CharSequence), setStartOffset (int), setEndOffset (int) setType (java.lang.String) su Token.DEFAULT_TYPE |
16 | Token reinit(String newTerm, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) Abbreviazione per chiamare clear (), CharTermAttributeImpl.append (CharSequence, int, int), setStartOffset (int), setEndOffset (int) setType (java.lang.String) su Token.DEFAULT_TYPE |
17 | Token reinit(String newTerm, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) Abbreviazione per chiamare 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) Abbreviazione per chiamare clear (), CharTermAttributeImpl.append (CharSequence), setStartOffset (int), setEndOffset (int) setType (java.lang.String) |
19 | void reinit(Token prototype) Copia i campi del token prototipo in questo. |
20 | void reinit(Token prototype, char[] newTermBuffer, int offset, int length) Copia i campi del token prototipo in questo, con un termine diverso. |
21 | void reinit(Token prototype, String newTerm) Copia i campi del token prototipo in questo, con un termine diverso. |
22 | void setEndOffset(int offset) Imposta l'offset finale. |
23 | void setFlags(int flags) |
24 | void setOffset(int startOffset, int endOffset) Imposta l'offset iniziale e finale. |
25 | void setPayload(Payload payload) Imposta il payload di questo token. |
26 | void setPositionIncrement(int positionIncrement) Imposta l'incremento di posizione. |
27 | void setPositionLength(int positionLength) Imposta la lunghezza della posizione. |
28 | void setStartOffset(int offset) Imposta l'offset iniziale. |
29 | void setType(String type) Imposta il tipo lessicale. |
30 | int startOffset() Restituisce l'offset iniziale di questo token, la posizione del primo carattere corrispondente a questo token nel testo di origine. |
31 | String type() Restituisce il tipo lessicale di questo token. |
Metodi ereditati
Questa classe eredita i metodi dalle seguenti classi:
- org.apache.lucene.analysis.tokenattributes.TermAttributeImpl
- org.apache.lucene.analysis.tokenattributes.CharTermAttributeImpl
- org.apache.lucene.util.AttributeImpl
- java.lang.Object