|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.swabunga.spell.event.AbstractWordTokenizer
This class tokenizes a input string.
It also allows for the string to be mutated. The result after the spell checking is completed is available to the call to getFinalText
Field Summary | |
protected Word |
currentWord
|
protected WordFinder |
finder
|
protected java.text.BreakIterator |
sentenceIterator
|
protected int |
wordCount
The cumulative word count that have been processed |
Constructor Summary | |
AbstractWordTokenizer(java.lang.String text)
Creates a new AbstractWordTokenizer object. |
|
AbstractWordTokenizer(WordFinder wf)
Creates a new AbstractWordTokenizer object. |
Method Summary | |
java.lang.String |
getContext()
Returns the current text that is being tokenized (includes any changes that have been made) |
int |
getCurrentWordCount()
Returns the current number of words that have been processed |
int |
getCurrentWordEnd()
Returns the end of the current word in the text |
int |
getCurrentWordPosition()
Returns the index of the start of the curent word in the text |
boolean |
hasMoreWords()
Returns true if there are more words that can be processed in the string |
boolean |
isNewSentence()
returns true if the current word is at the start of a sentence |
java.lang.String |
nextWord()
Returns searches for the next word in the text, and returns that word. |
abstract void |
replaceWord(java.lang.String newWord)
Replaces the current word token |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Word currentWord
protected WordFinder finder
protected java.text.BreakIterator sentenceIterator
protected int wordCount
Constructor Detail |
public AbstractWordTokenizer(java.lang.String text)
text
- the text to process.public AbstractWordTokenizer(WordFinder wf)
wf
- the custom WordFinder to use in searching for words.Method Detail |
public int getCurrentWordCount()
getCurrentWordCount
in interface WordTokenizer
public int getCurrentWordEnd()
getCurrentWordEnd
in interface WordTokenizer
WordNotFoundException
- current word has not yet been set.public int getCurrentWordPosition()
getCurrentWordPosition
in interface WordTokenizer
WordNotFoundException
- current word has not yet been set.public boolean hasMoreWords()
hasMoreWords
in interface WordTokenizer
public java.lang.String nextWord()
nextWord
in interface WordTokenizer
WordNotFoundException
- search string contains no more words.public abstract void replaceWord(java.lang.String newWord)
replaceWord
in interface WordTokenizer
newWord
- replacement word.
WordNotFoundException
- current word has not yet been set.public java.lang.String getContext()
getContext
in interface WordTokenizer
public boolean isNewSentence()
isNewSentence
in interface WordTokenizer
WordNotFoundException
- current word has not yet been set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |