Modifier and Type | Field and Description |
---|---|
protected com.attivio.sdk.token.TokenList.Element |
head
The head pointer for this Position.
|
protected com.attivio.sdk.token.TokenList.Element |
tail
The tail pointer for this Position.
|
protected TokenList |
tokens
The TokenList this Position points into.
|
Constructor and Description |
---|
Position()
Expert: create an unpositioned position.
|
Modifier and Type | Method and Description |
---|---|
void |
add(CharSequence token,
TokenAnnotation annotation,
boolean indexed)
Add an annotated token to this Position.
|
void |
add(String token)
Add an indexed token to this Position.
|
void |
add(String token,
TokenAnnotation annotation)
Add an annotated token to this Position.
|
void |
add(String token,
TokenAnnotation annotation,
boolean indexed)
Add an annotated token to this Position.
|
void |
add(Token t)
Add a Token to this Position.
|
Position |
clone()
TODO: document caution when working with cloned Positions.
|
boolean |
contains(TokenAnnotation annotation)
Returns
true if any token at this position is marked with annotation . |
Token |
endScope(String name)
Mark this position as the last position in scope
name . |
Token |
get()
Get the primary Token for this position.
|
Token[] |
get(TokenAnnotation annotation)
Get all Tokens for this position that contain the specified annotation.
|
int |
getEndOffset()
Get the end offset from the source text for this position.
|
int |
getIncrement()
Gets the position increment for this Position.
|
ScopeInfo |
getScopePostfix()
Get the
ScopeInfo for all scope changes new for this position. |
ScopeInfo |
getScopePostfix(ScopeInfo reuse)
Advanced form of
getScopePrefix() that supports reusing ScopeInfo instances. |
ScopeInfo |
getScopePrefix()
Get the
ScopeInfo for all scope changes new for this position. |
ScopeInfo |
getScopePrefix(ScopeInfo reuse)
Advanced form of
getScopePrefix() that supports reusing ScopeInfo instances. |
int |
getStartOffset()
Get the start offset from the source text for this position.
|
Token |
getSurfaceToken()
Returns the first token in this position that is a surface token.
|
Token[] |
getTokens()
Gets all Tokens for this Position.
|
boolean |
isIndexed()
Gets if this position has any indexed tokens.
|
boolean |
isPhraseBreak()
Returns
true if this position causes a phrase break. |
boolean |
isValid()
Returns
true if this Position is valid. |
void |
remove()
Remove this position.
|
void |
remove(TokenAnnotation annotation)
Remove all tokens from this Position with the specified
annotation . |
Position |
seek(Position other)
Expert: Seek this position to the same position as
other . |
void |
setEndOffset(int offset)
Deprecated.
token offsets should not be modified at the position level and should instead be set when the token is created.
|
void |
setIncrement(int increment)
Sets the position increment for this Position.
|
void |
setStartOffset(int offset)
Deprecated.
token offsets should not be modified at the position level and should instead be set when the token is created.
|
Token |
startScope(String name)
Mark this position as the first position in scope
name . |
Phrase |
toPhrase() |
Phrase |
toPhrase(int offsetBase) |
void |
toQueryString(StringBuilder buffer)
Encode this Position into
buffer suitable for parsing inside a phrase() operator. |
String |
toString() |
protected TokenList tokens
protected com.attivio.sdk.token.TokenList.Element head
protected com.attivio.sdk.token.TokenList.Element tail
public boolean isValid()
true
if this Position is valid.public ScopeInfo getScopePrefix()
ScopeInfo
for all scope changes new for this position.
Returns null
if no scope transitions occur prior to this position.
public ScopeInfo getScopePostfix()
ScopeInfo
for all scope changes new for this position.
Returns null
if no scope transitions occur prior to this position.
public ScopeInfo getScopePrefix(ScopeInfo reuse)
getScopePrefix()
that supports reusing ScopeInfo
instances.public ScopeInfo getScopePostfix(ScopeInfo reuse)
getScopePrefix()
that supports reusing ScopeInfo
instances.public int getStartOffset()
NOTE: this is the start offset for the surface token for this position.
public int getEndOffset()
NOTE: this is the end offset for the surface token for this position.
@Deprecated public void setStartOffset(int offset)
@Deprecated public void setEndOffset(int offset)
public boolean isIndexed()
public boolean isPhraseBreak()
true
if this position causes a phrase break.
NOTE: phrase searches will not match across a phrase break.
public int getIncrement()
public void setIncrement(int increment)
public Token startScope(String name)
name
.
Returns the scope Token
to support adding additional annotations.
public Token endScope(String name)
name
.
Returns the scope Token
to support adding additional annotations.
public Token getSurfaceToken()
public void remove(TokenAnnotation annotation)
annotation
.
NOTE: if every Token at this Position is annotated with annotation
then the entire position will be removed.
public void remove()
public Token get()
public Token[] getTokens()
public Phrase toPhrase()
public Phrase toPhrase(int offsetBase)
public Token[] get(TokenAnnotation annotation)
If no tokens with the specified annotation exist at this position, a 0 length array is returned.
public boolean contains(TokenAnnotation annotation)
true
if any token at this position is marked with annotation
.public void add(Token t)
public void add(String token)
public void add(String token, TokenAnnotation annotation)
This method is appropriate for adding lemmas, and similar tokens.
NOTE: This token will not be indexed. Use add(String, TokenAnnotation, boolean) to add an indexed token.
public void add(String token, TokenAnnotation annotation, boolean indexed)
This method is appropriate for adding lemmas, and similar tokens.
public void add(CharSequence token, TokenAnnotation annotation, boolean indexed)
This method is appropriate for adding lemmas, and similar tokens.
public void toQueryString(StringBuilder buffer)
buffer
suitable for parsing inside a phrase() operator.Copyright © 2018 Attivio, Inc. All Rights Reserved.
PATENT NOTICE: Attivio, Inc. Software Related Patents. With respect to the Attivio software product(s) being used, the following patents apply: Querying Joined Data Within A Search Engine Index: United States Patent No.(s): 8,073,840. Ordered Processing of Groups of Messages: U.S. Patent No.(s) 8,495,656. Signal processing approach to sentiment analysis for entities in documents: U.S. Patent No.(s) 8,725,494. Other U.S. and International Patents Pending.