Package com.swabunga.spell.event
Class TeXWordFinder
- java.lang.Object
-
- com.swabunga.spell.event.AbstractWordFinder
-
- com.swabunga.spell.event.TeXWordFinder
-
- All Implemented Interfaces:
WordFinder
public class TeXWordFinder extends AbstractWordFinder
A word finder for TeX and LaTeX documents, which searches text for sequences of letters, but ignores any commands and environments as well as Math environments.- Author:
- Anthony Roy (ajr@antroy.co.uk)
-
-
Field Summary
Fields Modifier and Type Field Description static int
REG_EXPR
A type where regular expressions are used to define expression to ignorestatic int
STRING_EXPR
A type where string expressions are used to define expression to ignore-
Fields inherited from class com.swabunga.spell.event.AbstractWordFinder
currentWord, nextWord, sentenceIterator, startsSentence, text
-
-
Constructor Summary
Constructors Constructor Description TeXWordFinder()
Creates a new DefaultWordFinder object.TeXWordFinder(java.lang.String inText)
Creates a new DefaultWordFinder object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUserDefinedIgnores(java.util.Collection expressions, int regex)
This method is used to import a user defined set of either strings or regular expressions to ignore.Word
next()
This method scans the text from the end of the last word, and returns a new Word object corresponding to the next word.void
setIgnoreComments(boolean ignore)
Define if comments contents are ignored during spell checking-
Methods inherited from class com.swabunga.spell.event.AbstractWordFinder
current, getText, hasNext, ignore, ignore, ignore, ignore, init, isWordChar, isWordChar, replace, setSentenceIterator, setText, startsSentence, toString
-
-
-
-
Field Detail
-
STRING_EXPR
public static final int STRING_EXPR
A type where string expressions are used to define expression to ignore- See Also:
- Constant Field Values
-
REG_EXPR
public static final int REG_EXPR
A type where regular expressions are used to define expression to ignore- See Also:
- Constant Field Values
-
-
Method Detail
-
next
public Word next()
This method scans the text from the end of the last word, and returns a new Word object corresponding to the next word.- Specified by:
next
in interfaceWordFinder
- Specified by:
next
in classAbstractWordFinder
- Returns:
- the next word.
- Throws:
WordNotFoundException
- search string contains no more words.
-
addUserDefinedIgnores
public void addUserDefinedIgnores(java.util.Collection expressions, int regex)
This method is used to import a user defined set of either strings or regular expressions to ignore.- Parameters:
expressions
- a collection of Objects whose toString() value should be the expression. Typically String objects.regex
- is an integer specifying the type of expression to use. e.g. REG_EXPR, STRING_EXPR.
-
setIgnoreComments
public void setIgnoreComments(boolean ignore)
Define if comments contents are ignored during spell checking- Parameters:
ignore
- an indication if comments content is to be ignored
-
-