Package org.omegat.tokenizer
Class WordIterator
java.lang.Object
java.text.BreakIterator
org.omegat.tokenizer.WordIterator
- All Implemented Interfaces:
Cloneable
BreakIterator for word-breaks with OmegaT heuristics, based on an instance of
BreakIterator implementing word breaks.
- See Also:
-
Field Summary
Fields inherited from class java.text.BreakIterator
DONE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcurrent()Return character index of the text boundary that was most recently returned by next(), previous(), first(), or last()intfirst()Return the first boundary.intfollowing(int offset) Not yet implemented! Throws a RuntimeException if you try to call it. Return the first boundary following the specified offset.getText()Not yet implemented! Throws a RuntimeException if you try to call it. Get the text being scannedintlast()Not yet implemented! Throws a RuntimeException if you try to call it. Return the last boundary.intnext()Return the boundary of the word following the current boundary.intnext(int n) Not yet implemented! Throws a RuntimeException if you try to call it. Return the nth boundary from the current boundaryintprevious()Not yet implemented! Throws a RuntimeException if you try to call it. Return the boundary preceding the current boundary.voidSet a new text string to be scanned.voidsetText(CharacterIterator newText) Not yet implemented! Throws a RuntimeException if you try to call it. Set a new text for scanning.Methods inherited from class java.text.BreakIterator
clone, getAvailableLocales, getCharacterInstance, getCharacterInstance, getLineInstance, getLineInstance, getSentenceInstance, getSentenceInstance, getWordInstance, getWordInstance, isBoundary, preceding
-
Constructor Details
-
WordIterator
public WordIterator()Creates a new instance of OmegaT's own word BreakIterator
-
-
Method Details
-
setText
Set a new text string to be scanned. The current scan position is reset to first().- Overrides:
setTextin classBreakIterator- Parameters:
newText- new text to scan.
-
first
public int first()Return the first boundary. The iterator's current position is set to the first boundary.- Specified by:
firstin classBreakIterator- Returns:
- The character index of the first text boundary.
-
current
public int current()Return character index of the text boundary that was most recently returned by next(), previous(), first(), or last()- Specified by:
currentin classBreakIterator- Returns:
- The boundary most recently returned.
-
next
public int next()Return the boundary of the word following the current boundary.Note: This iterator skips OmegaT-specific tags, and groups [text-]mnemonics-text into a single token.
- Specified by:
nextin classBreakIterator- Returns:
- The character index of the next text boundary or DONE if all boundaries have been returned. Equivalent to next(1).
-
next
public int next(int n) Not yet implemented! Throws a RuntimeException if you try to call it. Return the nth boundary from the current boundary- Specified by:
nextin classBreakIterator- Parameters:
n- which boundary to return. A value of 0 does nothing. Negative values move to previous boundaries and positive values move to later boundaries.- Returns:
- The index of the nth boundary from the current position.
-
following
public int following(int offset) Not yet implemented! Throws a RuntimeException if you try to call it. Return the first boundary following the specified offset. The value returned is always greater than the offset or the value BreakIterator.DONE- Specified by:
followingin classBreakIterator- Parameters:
offset- the offset to begin scanning. Valid values are determined by the CharacterIterator passed to setText(). Invalid values cause an IllegalArgumentException to be thrown.- Returns:
- The first boundary after the specified offset.
-
setText
Not yet implemented! Throws a RuntimeException if you try to call it. Set a new text for scanning. The current scan position is reset to first().- Specified by:
setTextin classBreakIterator- Parameters:
newText- new text to scan.
-
getText
Not yet implemented! Throws a RuntimeException if you try to call it. Get the text being scanned- Specified by:
getTextin classBreakIterator- Returns:
- the text being scanned
-
previous
public int previous()Not yet implemented! Throws a RuntimeException if you try to call it. Return the boundary preceding the current boundary.- Specified by:
previousin classBreakIterator- Returns:
- The character index of the previous text boundary or DONE if all boundaries have been returned.
-
last
public int last()Not yet implemented! Throws a RuntimeException if you try to call it. Return the last boundary. The iterator's current position is set to the last boundary.- Specified by:
lastin classBreakIterator- Returns:
- The character index of the last text boundary.
-