|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.corpus.ChunkTagHandlerAdapter
TagChunkCodecAdapters.chunkingToStringTagging(TagChunkCodec,ObjectHandler)
instead.
@Deprecated public class ChunkTagHandlerAdapter
A ChunkTagHandlerAdapter converts a chunk handler to a
BIO-coded tag handler. The adapters handles BIO-encoded taggings
by converting them to chunkings and then delegating them to the
contained chunk handler.
For the definition of the BIO encoding scheme and an example,
see ChunkHandlerAdapter. This class performs the inverse
adaptation, taking the array of whitespaces, tokens and tags and
producing the specified chunking. Unlike the case for adapting tag
handlers, there is no need to specify a tokenizer factory and no
possibility of taggings being inconsistent with a chunk handler.
The static method toChunkingBIO(String[],String[],String[]) is used to convert
BIO-coded taggings to chunkings.
| Field Summary | |
|---|---|
static String |
BEGIN_TAG_PREFIX
Deprecated. The prefix to which a tag is appended to produce a begin tag, namely "B-". |
static String |
IN_TAG_PREFIX
Deprecated. The prefix to which a tag is appended to produce a continuation, or "in" tag, namely "I-". |
static String |
OUT_TAG
Deprecated. The tag assigned to tokens that are not in a chunk, namely "O" (the letter O). |
| Constructor Summary | |
|---|---|
ChunkTagHandlerAdapter()
Deprecated. Construct a tag handler with no specified chunk handler. |
|
ChunkTagHandlerAdapter(ObjectHandler<Chunking> handler)
Deprecated. Construct a tag handler adapter with the specified chunk handler. |
|
| Method Summary | |
|---|---|
void |
handle(String[] tokens,
String[] whitespaces,
String[] tags)
Deprecated. Handle the specified arrays of tokens, whitespaces and tags. |
static boolean |
isBeginTag(String tag)
Deprecated. Returns true if the specified tag is the first
token in a chunk. |
static boolean |
isInTag(String tag)
Deprecated. Returns true if the specified tag is for the
continuation of a chunk. |
static boolean |
isOutTag(String tag)
Deprecated. Returns true if the specified tag is for the first
token in a chunk. |
void |
setChunkHandler(ObjectHandler<Chunking> handler)
Deprecated. Sets the contained chunk handler to the specified value. |
static String |
toBaseTag(String tag)
Deprecated. Returns the base tag for the specified begin or continuation tag. |
static String |
toBeginTag(String type)
Deprecated. Returns the begin tag for the specified type. |
static Chunking |
toChunkingBIO(String[] tokens,
String[] whitespaces,
String[] tags)
Deprecated. Converts the BIO-coded tokens, whitespaces and tags into a chunking. |
static String |
toInTag(String type)
Deprecated. Returns the continuation tag for the specified type. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static String OUT_TAG
"O" (the letter O).
public static String BEGIN_TAG_PREFIX
"B-".
public static String IN_TAG_PREFIX
"I-".
| Constructor Detail |
|---|
public ChunkTagHandlerAdapter()
setChunkHandler(ObjectHandler), and must be called at least
once before handling input taggings if this constructor is
used.
public ChunkTagHandlerAdapter(ObjectHandler<Chunking> handler)
setChunkHandler(ObjectHandler).
handler - Chunk handler.| Method Detail |
|---|
public void setChunkHandler(ObjectHandler<Chunking> handler)
handle(String[],String[],String[]) result in the
correspdoning chunking being created and passed to the
specified chunk handler.
handler - Chunk handler.
public void handle(String[] tokens,
String[] whitespaces,
String[] tags)
The token and tag arrays must be the same length. The
whitespaces array may be null, in which case each
space is treated as a single whitespace character
(' '). If the whitespaces array is not null,
it must be one element longer than the tokens array.
If the chunk handler has not been set in the construct or
by setChunkHandler(ObjectHandler), this call will raise
a null pointer exception.
handle in interface TagHandlertokens - Array of tokens.whitespaces - Array of whitespaces.tags - Array of tags.
IllegalArgumentException - If the tokens, whitespaces and
tags are not aligned.public static String toBaseTag(String tag)
tag - Tag to convert to base form.
public static boolean isBeginTag(String tag)
true if the specified tag is the first
token in a chunk. The first token is labeled with a begin tag,
consisting of the begin-tag prefix BEGIN_TAG_PREFIX
appended to a type.
tag - Tag to test.
true if the tag is for the first token in a
chunk.public static boolean isOutTag(String tag)
true if the specified tag is for the first
token in a chunk. The first token is labeled with a begin tag,
consisting of the begin-tag prefix BEGIN_TAG_PREFIX
appended to a type.
tag - Tag to test.
true if the tag is for the first token in a
chunk.public static boolean isInTag(String tag)
true if the specified tag is for the
continuation of a chunk. A continuation token is labeled with
a continuation or "in" tag, consisting of the
in-tag prefix IN_TAG_PREFIX appended to a type.
tag - Tag to test.
true if the tag is for the continuation of
a chunk.public static String toInTag(String type)
IN_TAG_PREFIX constant
prepended to the specified type.
type - Type to convert to continuation tag.
public static String toBeginTag(String type)
BEGIN_TAG_PREFIX constant
prepended to the specified type.
type - Type to convert to begin tag.
public static Chunking toChunkingBIO(String[] tokens,
String[] whitespaces,
String[] tags)
tokens - Tokens for tagging.whitespaces - Whitespaces for tagging.tags - BIO-coded tags.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||