public class ChunkedWordIter extends BasicWordIter implements Cloneable
Chunks. Applies section limits at empty chunks
(section limits can be overcome in any method to which they apply by
simply setting the 'force' parameter.)| Modifier and Type | Field and Description |
|---|---|
protected Chunk |
chunk
Current chunk whose tokens we're currently traversing
|
protected ChunkSource |
chunkSource
Source for fetching chunks
|
maxWordPos, text, tokens, tokNum, wordPosFIELD_END, FIELD_START, TERM_END, TERM_END_PLUS, TERM_START| Constructor and Description |
|---|
ChunkedWordIter(ChunkSource chunkSource)
Construct the iterator to access text from the given chunk source.
|
| Modifier and Type | Method and Description |
|---|---|
MarkPos |
createPos() |
void |
getPos(MarkPos pos,
int startOrEnd)
Replace the position within a MarkPos created by
WordIter.getPos(int)
using the iterator's current position. |
boolean |
next(boolean force)
Advance to the next word.
|
boolean |
prev(boolean force)
Back up to the previous word.
|
protected void |
reseek(Chunk toChunk) |
protected void |
reseek(int targetPos) |
void |
seekFirst(int targetPos,
boolean force)
Reposition the iterator at the first word whose position is
greater than or equal to 'wordPos'.
|
void |
seekLast(int targetPos,
boolean force)
Reposition the iterator at the last word whose position is
less than or equal to 'wordPos'.
|
clone, getPos, termprotected ChunkSource chunkSource
protected Chunk chunk
public ChunkedWordIter(ChunkSource chunkSource)
chunkSource - Source to read chunks from.public boolean next(boolean force)
WordIternext in interface WordIternext in class BasicWordIterforce - true to ignore section boundariespublic boolean prev(boolean force)
WordIterprev in interface WordIterprev in class BasicWordIterforce - true to ignore section boundariesprotected void reseek(int targetPos)
protected void reseek(Chunk toChunk)
public void seekFirst(int targetPos,
boolean force)
WordIterseekFirst in interface WordIterseekFirst in class BasicWordItertargetPos - Position to seek toforce - true to ignore section boundariespublic void seekLast(int targetPos,
boolean force)
WordIterseekLast in interface WordIterseekLast in class BasicWordItertargetPos - Position to seek toforce - true to ignore section boundariespublic MarkPos createPos()
public void getPos(MarkPos pos, int startOrEnd)
WordIterWordIter.getPos(int)
using the iterator's current position.getPos in interface WordItergetPos in class BasicWordIterstartOrEnd - FIELD_START for the very start of the field;
TERM_START for the first character of the word;
TERM_END for the last character of the word;
TERM_END_PLUS for the last character plus any trailing
punctuation and/or spaces;
FIELD_END for the very last end of the field.