pt.tumba.cluster
Class DefaultWordFinder
java.lang.Object
pt.tumba.cluster.DefaultWordFinder
- Direct Known Subclasses:
- TeXWordFinder, XMLWordFinder
public class DefaultWordFinder
- extends java.lang.Object
Defines common methods and behaviour for the various word finding
subclasses.
Method Summary |
java.lang.String |
current()
|
java.lang.String |
currentSegment()
|
private int |
getNextWordEnd(java.lang.String text,
int startPos)
Returns the position in the string after the end of the next word. |
java.lang.String |
getText()
|
boolean |
hasNext()
|
protected int |
ignore(int index,
char startIgnore)
|
protected int |
ignore(int index,
java.lang.Character startIgnore,
java.lang.Character endIgnore)
|
protected int |
ignore(int index,
char startIgnore,
char endIgnore)
|
protected int |
ignore(int index,
java.lang.String startIgnore,
java.lang.String endIgnore)
|
private int |
indexSegmentChar(java.lang.String aux)
|
protected void |
init()
|
protected boolean |
isWordChar(char c)
|
protected boolean |
isWordChar(int posn)
|
java.lang.String |
next()
|
java.lang.String |
nextSegment()
|
void |
replace(java.lang.String newWord)
|
protected void |
setSentenceIterator(java.lang.String wd)
|
void |
setText(java.lang.String newText)
|
private void |
setup()
|
boolean |
startsSentence()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
currentWord
protected java.lang.String currentWord
nextWord
protected java.lang.String nextWord
currentWordPos
protected int currentWordPos
nextWordPos
protected int nextWordPos
startsSentence
protected boolean startsSentence
text
protected java.lang.String text
sentenceIterator
protected java.text.BreakIterator sentenceIterator
currentSegment
protected java.lang.String currentSegment
DefaultWordFinder
public DefaultWordFinder(java.lang.String inText)
DefaultWordFinder
public DefaultWordFinder()
currentSegment
public java.lang.String currentSegment()
indexSegmentChar
private int indexSegmentChar(java.lang.String aux)
nextSegment
public java.lang.String nextSegment()
getText
public java.lang.String getText()
setText
public void setText(java.lang.String newText)
current
public java.lang.String current()
hasNext
public boolean hasNext()
replace
public void replace(java.lang.String newWord)
startsSentence
public boolean startsSentence()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
setSentenceIterator
protected void setSentenceIterator(java.lang.String wd)
isWordChar
protected boolean isWordChar(int posn)
isWordChar
protected boolean isWordChar(char c)
ignore
protected int ignore(int index,
char startIgnore)
ignore
protected int ignore(int index,
char startIgnore,
char endIgnore)
ignore
protected int ignore(int index,
java.lang.Character startIgnore,
java.lang.Character endIgnore)
ignore
protected int ignore(int index,
java.lang.String startIgnore,
java.lang.String endIgnore)
init
protected void init()
setup
private void setup()
next
public java.lang.String next()
getNextWordEnd
private int getNextWordEnd(java.lang.String text,
int startPos)
- Returns the position in the string after the end of the next word.
Note that this return value should not be used as an index into the string
without checking first that it is in range, since it is possible for the
value
text.length()
to be returned by this method.