public class LabeledChunkIdentifier extends Object
Modifier and Type | Class and Description |
---|---|
static class |
LabeledChunkIdentifier.LabelTagType
Class representing a label, tag and type
|
Constructor and Description |
---|
LabeledChunkIdentifier() |
Modifier and Type | Method and Description |
---|---|
List<CoreMap> |
getAnnotatedChunks(List<CoreLabel> tokens,
int totalTokensOffset,
Class textKey,
Class labelKey)
Find and annotate chunks.
|
List<CoreMap> |
getAnnotatedChunks(List<CoreLabel> tokens,
int totalTokensOffset,
Class textKey,
Class labelKey,
Class tokenChunkKey,
Class tokenLabelKey) |
List<CoreMap> |
getAnnotatedChunks(List<CoreLabel> tokens,
int totalTokensOffset,
Class textKey,
Class labelKey,
Class tokenChunkKey,
Class tokenLabelKey,
java.util.function.Function<Pair<CoreLabel,CoreLabel>,Boolean> checkTokensCompatible)
Find and annotate chunks.
|
List<CoreMap> |
getAnnotatedChunks(List<CoreLabel> tokens,
int totalTokensOffset,
Class textKey,
Class labelKey,
java.util.function.Function<Pair<CoreLabel,CoreLabel>,Boolean> checkTokensCompatible) |
String |
getDefaultNegTag() |
String |
getDefaultPosTag() |
String |
getNegLabel() |
LabeledChunkIdentifier.LabelTagType |
getTagType(String label) |
static boolean |
isChunk(LabeledChunkIdentifier.LabelTagType cur) |
static boolean |
isEndOfChunk(LabeledChunkIdentifier.LabelTagType prev,
LabeledChunkIdentifier.LabelTagType cur)
Returns whether a chunk ended between the previous and current token
|
static boolean |
isEndOfChunk(String prevTag,
String prevType,
String curTag,
String curType)
Returns whether a chunk ended between the previous and current token
|
boolean |
isIgnoreProvidedTag() |
static boolean |
isStartOfChunk(LabeledChunkIdentifier.LabelTagType prev,
LabeledChunkIdentifier.LabelTagType cur)
Returns whether a chunk started between the previous and current token
|
static boolean |
isStartOfChunk(String prevTag,
String prevType,
String curTag,
String curType)
Returns whether a chunk started between the previous and current token
|
void |
setDefaultNegTag(String defaultNegTag) |
void |
setDefaultPosTag(String defaultPosTag) |
void |
setIgnoreProvidedTag(boolean ignoreProvidedTag) |
void |
setNegLabel(String negLabel) |
public List<CoreMap> getAnnotatedChunks(List<CoreLabel> tokens, int totalTokensOffset, Class textKey, Class labelKey)
tokens
- - List of tokens to look for chunkstotalTokensOffset
- - Index of tokens to offset bytextKey
- - Key to use to find the token textlabelKey
- - Key to use to find the token label (to determine if inside chunk or not)public List<CoreMap> getAnnotatedChunks(List<CoreLabel> tokens, int totalTokensOffset, Class textKey, Class labelKey, java.util.function.Function<Pair<CoreLabel,CoreLabel>,Boolean> checkTokensCompatible)
public List<CoreMap> getAnnotatedChunks(List<CoreLabel> tokens, int totalTokensOffset, Class textKey, Class labelKey, Class tokenChunkKey, Class tokenLabelKey)
public List<CoreMap> getAnnotatedChunks(List<CoreLabel> tokens, int totalTokensOffset, Class textKey, Class labelKey, Class tokenChunkKey, Class tokenLabelKey, java.util.function.Function<Pair<CoreLabel,CoreLabel>,Boolean> checkTokensCompatible)
tokens
- - List of tokens to look for chunkstotalTokensOffset
- - Index of tokens to offset bylabelKey
- - Key to use to find the token label (to determine if inside chunk or not)textKey
- - Key to use to find the token texttokenChunkKey
- - If not null, each token is annotated with the chunk using this keytokenLabelKey
- - If not null, each token is annotated with the text associated with the chunk using this keycheckTokensCompatible
- - If not null, additional check to see if this token and the previous are compatiblepublic static boolean isEndOfChunk(String prevTag, String prevType, String curTag, String curType)
prevTag
- - the tag of the previous tokenprevType
- - the type of the previous tokencurTag
- - the tag of the current tokencurType
- - the type of the current tokenpublic static boolean isEndOfChunk(LabeledChunkIdentifier.LabelTagType prev, LabeledChunkIdentifier.LabelTagType cur)
prev
- - the label/tag/type of the previous tokencur
- - the label/tag/type of the current tokenpublic static boolean isStartOfChunk(String prevTag, String prevType, String curTag, String curType)
prevTag
- - the tag of the previous tokenprevType
- - the type of the previous tokencurTag
- - the tag of the current tokencurType
- - the type of the current tokenpublic static boolean isStartOfChunk(LabeledChunkIdentifier.LabelTagType prev, LabeledChunkIdentifier.LabelTagType cur)
prev
- - the label/tag/type of the previous tokencur
- - the label/tag/type of the current tokenpublic static boolean isChunk(LabeledChunkIdentifier.LabelTagType cur)
public LabeledChunkIdentifier.LabelTagType getTagType(String label)
public String getDefaultPosTag()
public void setDefaultPosTag(String defaultPosTag)
public String getDefaultNegTag()
public void setDefaultNegTag(String defaultNegTag)
public String getNegLabel()
public void setNegLabel(String negLabel)
public boolean isIgnoreProvidedTag()
public void setIgnoreProvidedTag(boolean ignoreProvidedTag)