com.aliasi.chunk
Class ChunkFactory

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

public class ChunkFactory
extends Object

The ChunkFactory provides static factory methods for creating chunks from components. Each chunk must specify the index of its first character and the index of one past its last character. A chunk may optionally specify a string-based type and score. If a type or score is not specified, the default values DEFAULT_CHUNK_TYPE and DEFAULT_CHUNK_SCORE, respecitively.

Since:
LingPipe2.1
Version:
2.1
Author:
Bob Carpenter

Field Summary
static double DEFAULT_CHUNK_SCORE
          The default chunk score, Double.NEGATIVE_INFINITY.
static String DEFAULT_CHUNK_TYPE
          The default chunk type, "CHUNK".
 
Method Summary
static Chunk createChunk(int start, int end)
          Return a chunk with the specified start and end positions, with default type and score.
static Chunk createChunk(int start, int end, double score)
          Return a chunk with the specified start and end positions, specified score and default type.
static Chunk createChunk(int start, int end, String type)
          Return a chunk with the specified start and end positions, specified type and default score.
static Chunk createChunk(int start, int end, String type, double score)
          Return a chunk with the specified start and end positions, type and score.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CHUNK_TYPE

public static final String DEFAULT_CHUNK_TYPE
The default chunk type, "CHUNK".

See Also:
Constant Field Values

DEFAULT_CHUNK_SCORE

public static final double DEFAULT_CHUNK_SCORE
The default chunk score, Double.NEGATIVE_INFINITY. This value, unlike Double.NaN, is less than other double values and equal (==) to itself.

See Also:
Constant Field Values
Method Detail

createChunk

public static Chunk createChunk(int start,
                                int end)
Return a chunk with the specified start and end positions, with default type and score. The default type is given by DEFAULT_CHUNK_TYPE and default score by DEFAULT_CHUNK_SCORE.

Parameters:
start - Index of the first character in the chunk.
end - Index of one past the last character in the chunk.
Returns:
The created chunk.
Throws:
IllegalArgumentException - If start is less than zero or end is less than start.

createChunk

public static Chunk createChunk(int start,
                                int end,
                                String type)
Return a chunk with the specified start and end positions, specified type and default score. The default score is given by DEFAULT_CHUNK_SCORE.

Parameters:
start - Index of the first character in the chunk.
end - Index of one past the last character in the chunk.
type - Type of the chunk created.
Returns:
The created chunk.
Throws:
IllegalArgumentException - If start is less than zero or end is less than start.

createChunk

public static Chunk createChunk(int start,
                                int end,
                                double score)
Return a chunk with the specified start and end positions, specified score and default type. The default type is given by DEFAULT_CHUNK_TYPE.

Parameters:
start - Index of the first character in the chunk.
end - Index of one past the last character in the chunk.
score - Score of created chunk.
Returns:
The created chunk.
Throws:
IllegalArgumentException - If start is less than zero or end is less than start.

createChunk

public static Chunk createChunk(int start,
                                int end,
                                String type,
                                double score)
Return a chunk with the specified start and end positions, type and score.

Parameters:
start - Index of the first character in the chunk.
end - Index of one past the last character in the chunk.
type - Type of the chunk created.
score - Score of created chunk.
Returns:
The created chunk.
Throws:
IllegalArgumentException - If start is less than zero or end is less than start.