Package com.swabunga.spell.event
Class StringWordTokenizer
java.lang.Object
com.swabunga.spell.event.AbstractWordTokenizer
com.swabunga.spell.event.StringWordTokenizer
- All Implemented Interfaces:
WordTokenizer
This class tokenizes a input string.
It also allows for the string to be altered by calls to replaceWord(). The result after the spell checking is completed is available to the call to getContext.
- Author:
- Jason Height (jheight@chariot.net.au), Anthony Roy (ajr@antroy.co.uk)
-
Field Summary
Fields inherited from class com.swabunga.spell.event.AbstractWordTokenizer
currentWord, finder, sentenceIterator, wordCount
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new StringWordTokenizer object.Creates a new StringWordTokenizer object.StringWordTokenizer
(String s, WordFinder finder) Creates a new StringWordTokenizer object. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.use getContext() instead as per the WordTokenizer interface specification.void
Replace the current word in the iteration with the String s.Methods inherited from class com.swabunga.spell.event.AbstractWordTokenizer
getContext, getCurrentWordCount, getCurrentWordEnd, getCurrentWordPosition, hasMoreWords, isNewSentence, nextWord
-
Constructor Details
-
StringWordTokenizer
Creates a new StringWordTokenizer object.- Parameters:
s
- the string to tokenize.
-
StringWordTokenizer
Creates a new StringWordTokenizer object.- Parameters:
wf
- the custom WordFinder to use in tokenizing. Note that the string to tokenize will be encapsulated within the WordFinder.
-
StringWordTokenizer
Creates a new StringWordTokenizer object.- Parameters:
s
- the string to work onfinder
- the custom WordFinder to use in tokenizing. Note that the string to tokenize will be encapsulated within the WordFinder.
-
-
Method Details
-
getFinalText
Deprecated.use getContext() instead as per the WordTokenizer interface specification.- Returns:
- the final text.
-
replaceWord
Replace the current word in the iteration with the String s.- Specified by:
replaceWord
in interfaceWordTokenizer
- Specified by:
replaceWord
in classAbstractWordTokenizer
- Parameters:
s
- the String to replace the current word.- Throws:
WordNotFoundException
- current word not yet set.
-