com.aliasi.chunk
Class TagChunkCodecAdapters

java.lang.Object
  extended by com.aliasi.chunk.TagChunkCodecAdapters

public class TagChunkCodecAdapters
extends Object

The TagChunkCodecAdapters class contains static utility methods for adapting tagging handlers to chunking handlers and vice-versa using tag-chunk codecs.

Since:
LingPipe3.9.1
Version:
3.9.1
Author:
Bob Carpenter

Method Summary
static ObjectHandler<StringTagging> chunkingToStringTagging(TagChunkCodec codec, ObjectHandler<Chunking> handler)
          Return the string tagging handler that converts string taggings to chunkings.
static ObjectHandler<Tagging<String>> chunkingToTagging(TagChunkCodec codec, ObjectHandler<Chunking> handler)
          Returns the tagging handler that converts taggings to chunkings using the specified codec.
static ObjectHandler<Chunking> stringTaggingToChunking(TagChunkCodec codec, ObjectHandler<StringTagging> handler)
          Return the chunking handler that converts chunkings to taggings using the specified codec.
static ObjectHandler<Chunking> taggingToChunking(TagChunkCodec codec, ObjectHandler<Tagging<String>> handler)
          Return the chunking handler that converts chunkings to simple taggings using the specified codec.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

stringTaggingToChunking

public static ObjectHandler<Chunking> stringTaggingToChunking(TagChunkCodec codec,
                                                              ObjectHandler<StringTagging> handler)
Return the chunking handler that converts chunkings to taggings using the specified codec.

Parameters:
codec - Tag chunk coder/decoder for converting chunkings to string taggings.
handler - Handler to receive string taggings corresponding to chunkings.
Returns:
Chunking handler adapted from string tagging handler.

taggingToChunking

public static ObjectHandler<Chunking> taggingToChunking(TagChunkCodec codec,
                                                        ObjectHandler<Tagging<String>> handler)
Return the chunking handler that converts chunkings to simple taggings using the specified codec.

Parameters:
codec - Tag chunk coder/decoder for converting chunkings to taggings.
handler - Handler to receive string taggings corresponding to chunkings.
Returns:
Chunking handler adapted from string tagging handler.

chunkingToStringTagging

public static ObjectHandler<StringTagging> chunkingToStringTagging(TagChunkCodec codec,
                                                                   ObjectHandler<Chunking> handler)
Return the string tagging handler that converts string taggings to chunkings.

Parameters:
codec - Tag-chunk coder/decoder for converting string taggings to chunkings.
handler - Handler to receive chunkings.
Returns:
String tagging handler adapted from the chunking handler.

chunkingToTagging

public static ObjectHandler<Tagging<String>> chunkingToTagging(TagChunkCodec codec,
                                                               ObjectHandler<Chunking> handler)
Returns the tagging handler that converts taggings to chunkings using the specified codec. The conversion goes by means of a string tagging created from the tagging by concatenating all of the tokens and separating them with a single space character.

Parameters:
codec - Tag-chunk coder/decoder for converting string taggings to chunkings.
handler - Handler to receive chunkings.
Returns:
Tagging handler adapted from the chunking handler.