public class XMLRuleHandler extends DefaultHandler
Modifier and Type | Field and Description |
---|---|
protected static String |
AND |
protected int |
andGroupCounter |
protected static String |
ANTIPATTERN |
protected StringBuilder |
antiPatternExample |
protected List<CorrectExample> |
antipatternExamples |
protected StringBuilder |
antiPatternForRuleGroupExample |
protected List<CorrectExample> |
antipatternForRuleGroupsExamples |
protected static String |
CASE_SENSITIVE |
protected boolean |
caseSensitive |
protected List<String> |
categoryTags |
protected List<String> |
categoryToneTags |
protected ChunkTag |
chunkTag |
protected static String |
CHUNKTAG |
protected static String |
CHUNKTAG_REGEXP |
protected StringBuilder |
correctExample |
protected List<CorrectExample> |
correctExamples |
protected static String |
DEFAULT |
protected static String |
DISTANCETOKENS |
protected StringBuilder |
elements |
protected int |
endPositionCorrection |
protected Map<String,List<String>> |
equivalenceFeatures |
protected StringBuilder |
errorTriggerExample |
protected List<ErrorTriggeringExample> |
errorTriggeringExamples |
protected static String |
EXAMPLE |
protected StringBuilder |
exampleCorrection |
protected static String |
EXCEPTION |
protected Boolean |
exceptionLevelCaseSensitive |
protected boolean |
exceptionLevelCaseSet |
protected boolean |
exceptionPosNegation |
protected boolean |
exceptionPosRegExp |
protected String |
exceptionPosToken |
protected StringBuilder |
exceptions |
protected boolean |
exceptionSet |
protected boolean |
exceptionSpaceBefore |
protected boolean |
exceptionSpaceBeforeSet |
protected boolean |
exceptionStringInflected |
protected boolean |
exceptionStringNegation |
protected boolean |
exceptionStringRegExp |
protected boolean |
exceptionValidNext |
protected boolean |
exceptionValidPrev |
protected static String |
FALSE |
protected static String |
FEATURE |
protected static String |
GOAL_SPECIFIC |
protected String |
id |
static String |
ID |
protected static String |
IGNORE |
protected boolean |
inAndGroup |
protected boolean |
inAntiPatternExample |
protected boolean |
inAntiPatternForRuleGroupExample |
protected StringBuilder |
incorrectExample |
protected boolean |
inCorrectExample |
protected List<IncorrectExample> |
incorrectExamples |
protected boolean |
inErrorTriggerExample |
protected boolean |
inException |
protected static String |
INFLECTED |
protected boolean |
inIncorrectExample |
protected boolean |
inMarker |
protected boolean |
inMatch |
protected boolean |
inMessage |
protected boolean |
inOrGroup |
protected boolean |
inPattern |
protected boolean |
inPhrases |
protected boolean |
inRegex |
protected boolean |
inRuleGroup |
protected boolean |
inShortMessage |
protected boolean |
inShortMessageForRuleGroup |
protected boolean |
inSuggestion |
protected boolean |
inToken |
protected boolean |
inUnification |
protected boolean |
inUnificationDef |
protected boolean |
inUnificationNeutral |
protected boolean |
inUrl |
protected boolean |
inUrlForRuleGroup |
protected boolean |
isGoalSpecific |
protected String |
isGoalSpecificCategoryAttribute |
protected String |
isGoalSpecificRuleGroupAttribute |
protected boolean |
isPremiumRule |
protected Language |
language |
protected boolean |
lastPhrase
true when phraseref is the last element in the rule.
|
protected static String |
MARK |
protected static String |
MARKER |
protected StringBuilder |
match |
protected static String |
MATCH |
protected static String |
MAX |
protected int |
maxOccurrence |
protected StringBuilder |
message |
protected static String |
MESSAGE |
protected ResourceBundle |
messages |
protected static String |
MIN |
protected int |
minOccurrence |
protected static String |
MINPREVMATCHES |
static String |
NAME |
protected static String |
NEGATE |
protected static String |
NEGATE_POS |
protected static String |
NO |
protected static String |
OFF |
protected static String |
ON |
protected static String |
OR |
protected int |
orGroupCounter |
protected static String |
PATTERN |
protected PatternToken |
patternToken |
protected List<PatternToken> |
patternTokens
List of elements as specified by tokens.
|
protected String |
phraseId
Current phrase ID.
|
protected String |
phraseIdRef
ID reference to the phrase.
|
protected Map<String,List<List<PatternToken>>> |
phraseMap
Phrase store - elementLists keyed by phraseIds.
|
protected List<ArrayList<PatternToken>> |
phrasePatternTokens
Logically forking element list, used for including multiple phrases in the
current one.
|
protected static String |
PHRASES |
protected Locator |
pLocator |
protected boolean |
posNegation |
protected boolean |
posRegExp |
protected static String |
POSTAG |
protected static String |
POSTAG_REGEXP |
protected String |
posToken |
protected static String |
PREMIUM
Definitions of values in XML files.
|
protected String |
premiumCategoryAttribute |
protected String |
premiumFileAttribute |
protected String |
premiumRuleGroupAttribute |
protected StringBuilder |
regex |
protected boolean |
regexCaseSensitive |
protected org.languagetool.rules.patterns.XMLRuleHandler.RegexpMode |
regexMode |
protected static String |
REGEXP |
protected int |
regexpMark |
protected boolean |
regExpression |
protected static String |
RULE |
protected static String |
RULEGROUP |
protected String |
ruleGroupId |
protected List<String> |
ruleGroupTags |
protected List<String> |
ruleGroupToneTags |
protected List<AbstractPatternRule> |
rules |
protected static String |
RULES |
protected List<String> |
ruleTags |
protected List<String> |
ruleToneTags |
protected static String |
SCOPE |
protected StringBuilder |
shortMessage |
protected StringBuilder |
shortMessageForRuleGroup |
protected static String |
SKIP |
protected int |
skipPos |
protected static String |
SPACEBEFORE |
protected int |
startPositionCorrection |
protected static String |
SUGGESTION |
protected List<Match> |
suggestionMatches |
protected List<Match> |
suggestionMatchesOutMsg |
protected StringBuilder |
suggestionsOutMsg |
protected static String |
TABNAME |
protected static String |
TEMP_OFF |
protected static String |
TOKEN |
protected int |
tokenCounter |
protected boolean |
tokenInflected |
protected boolean |
tokenLevelCaseSensitive |
protected boolean |
tokenLevelCaseSet |
protected boolean |
tokenNegated |
protected Match |
tokenReference |
protected boolean |
tokenSpaceBefore |
protected boolean |
tokenSpaceBeforeSet |
protected static String |
TRUE |
protected static String |
TYPE |
protected String |
uFeature |
protected static String |
UNIFICATION |
protected static String |
UNIFY |
protected static String |
UNIFY_IGNORE |
protected boolean |
uniNegation |
protected StringBuilder |
url |
protected StringBuilder |
urlForRuleGroup |
protected String |
uType |
protected List<String> |
uTypeList |
protected int |
xmlLineNumber |
protected int |
xmlLineNumberAntiPattern |
protected static String |
YES |
Constructor and Description |
---|
XMLRuleHandler() |
Modifier and Type | Method and Description |
---|---|
protected List<Match> |
addLegacyMatches(List<Match> existingSugMatches,
String messageStr,
boolean inMessage)
Adds Match objects for all references to tokens
(including '\1' and the like).
|
void |
error(SAXParseException e) |
protected void |
finalizeExceptions() |
protected void |
finalizePhrase() |
protected void |
finalizeTokens(UnifierConfiguration unifierConfiguration) |
List<AbstractPatternRule> |
getRules() |
protected String |
internString(String s) |
protected void |
preparePhrase(Attributes attrs) |
protected void |
processElement(List<PatternToken> patternTokens)
Calculates the offset of the match reference (if any) in case the match
element has been used in the group.
|
protected void |
resetException() |
protected void |
resetToken() |
void |
setDocumentLocator(Locator locator) |
protected void |
setExceptions(Attributes attrs) |
protected void |
setMatchElement(Attributes attrs,
boolean isSuppressMisspelled) |
protected static void |
setRuleFilter(String filterClassName,
String filterArgs,
AbstractPatternRule rule) |
protected void |
setToken(Attributes attrs) |
protected void |
startPattern(Attributes attrs) |
void |
warning(SAXParseException e) |
characters, endDocument, endElement, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl
public static final String ID
public static final String NAME
protected static final String PREMIUM
protected static final String YES
protected static final String OFF
protected static final String GOAL_SPECIFIC
protected static final String TRUE
protected static final String FALSE
protected static final String TEMP_OFF
protected static final String ON
protected static final String POSTAG
protected static final String CHUNKTAG
protected static final String CHUNKTAG_REGEXP
protected static final String POSTAG_REGEXP
protected static final String REGEXP
protected static final String NEGATE
protected static final String INFLECTED
protected static final String NEGATE_POS
protected static final String MARKER
protected static final String DEFAULT
protected static final String TYPE
protected static final String SPACEBEFORE
protected static final String EXAMPLE
protected static final String SCOPE
protected static final String IGNORE
protected static final String SKIP
protected static final String MIN
protected static final String MAX
protected static final String TOKEN
protected static final String FEATURE
protected static final String UNIFY
protected static final String UNIFY_IGNORE
protected static final String AND
protected static final String OR
protected static final String EXCEPTION
protected static final String CASE_SENSITIVE
protected static final String MARK
protected static final String PATTERN
protected static final String ANTIPATTERN
protected static final String MATCH
protected static final String UNIFICATION
protected static final String RULE
protected static final String RULES
protected static final String RULEGROUP
protected static final String NO
protected static final String PHRASES
protected static final String MESSAGE
protected static final String SUGGESTION
protected static final String TABNAME
protected static final String MINPREVMATCHES
protected static final String DISTANCETOKENS
protected List<AbstractPatternRule> rules
protected Language language
protected ResourceBundle messages
protected StringBuilder correctExample
protected StringBuilder antiPatternExample
protected StringBuilder antiPatternForRuleGroupExample
protected StringBuilder incorrectExample
protected StringBuilder errorTriggerExample
protected StringBuilder exampleCorrection
protected StringBuilder message
protected StringBuilder suggestionsOutMsg
protected StringBuilder match
protected StringBuilder elements
protected StringBuilder exceptions
protected List<CorrectExample> correctExamples
protected List<CorrectExample> antipatternExamples
protected List<CorrectExample> antipatternForRuleGroupsExamples
protected List<IncorrectExample> incorrectExamples
protected List<ErrorTriggeringExample> errorTriggeringExamples
protected boolean inPattern
protected boolean inCorrectExample
protected boolean inIncorrectExample
protected boolean inErrorTriggerExample
protected boolean inAntiPatternExample
protected boolean inAntiPatternForRuleGroupExample
protected boolean inMessage
protected boolean inSuggestion
protected boolean inMatch
protected boolean inRuleGroup
protected boolean inToken
protected boolean inException
protected boolean inPhrases
protected boolean inAndGroup
protected boolean inOrGroup
protected boolean tokenSpaceBefore
protected boolean tokenSpaceBeforeSet
protected String posToken
protected ChunkTag chunkTag
protected boolean posNegation
protected boolean posRegExp
protected boolean caseSensitive
protected boolean regExpression
protected boolean tokenNegated
protected boolean tokenInflected
protected String premiumRuleGroupAttribute
protected String premiumCategoryAttribute
protected String premiumFileAttribute
protected boolean isPremiumRule
protected String isGoalSpecificCategoryAttribute
protected String isGoalSpecificRuleGroupAttribute
protected boolean isGoalSpecific
protected boolean tokenLevelCaseSensitive
protected boolean tokenLevelCaseSet
protected String exceptionPosToken
protected boolean exceptionStringRegExp
protected boolean exceptionStringNegation
protected boolean exceptionStringInflected
protected boolean exceptionPosNegation
protected boolean exceptionPosRegExp
protected boolean exceptionValidNext
protected boolean exceptionValidPrev
protected boolean exceptionSet
protected boolean exceptionSpaceBefore
protected boolean exceptionSpaceBeforeSet
protected Boolean exceptionLevelCaseSensitive
protected boolean exceptionLevelCaseSet
protected List<PatternToken> patternTokens
protected boolean lastPhrase
protected String phraseIdRef
protected String phraseId
protected int skipPos
protected int minOccurrence
protected int maxOccurrence
protected String ruleGroupId
protected String id
protected PatternToken patternToken
protected Match tokenReference
protected Locator pLocator
protected int xmlLineNumber
protected int xmlLineNumberAntiPattern
protected int startPositionCorrection
protected int endPositionCorrection
protected int tokenCounter
protected Map<String,List<List<PatternToken>>> phraseMap
protected List<ArrayList<PatternToken>> phrasePatternTokens
protected int andGroupCounter
protected int orGroupCounter
protected boolean inUrl
protected boolean inUrlForRuleGroup
protected StringBuilder url
protected StringBuilder urlForRuleGroup
protected boolean inRegex
protected StringBuilder regex
protected org.languagetool.rules.patterns.XMLRuleHandler.RegexpMode regexMode
protected boolean regexCaseSensitive
protected int regexpMark
protected boolean inShortMessage
protected boolean inShortMessageForRuleGroup
protected StringBuilder shortMessage
protected StringBuilder shortMessageForRuleGroup
protected boolean inUnification
protected boolean inMarker
protected boolean inUnificationDef
protected boolean uniNegation
protected boolean inUnificationNeutral
protected String uFeature
protected String uType
public List<AbstractPatternRule> getRules()
public void warning(SAXParseException e) throws SAXException
warning
in interface ErrorHandler
warning
in class DefaultHandler
SAXException
public void error(SAXParseException e) throws SAXException
error
in interface ErrorHandler
error
in class DefaultHandler
SAXException
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class DefaultHandler
protected void resetToken()
protected void resetException()
protected void preparePhrase(Attributes attrs)
protected void finalizePhrase()
protected void startPattern(Attributes attrs) throws SAXException
SAXException
protected void processElement(List<PatternToken> patternTokens)
patternTokens
- token list where the match element was used. It is directly changed.protected void setMatchElement(Attributes attrs, boolean isSuppressMisspelled) throws SAXException
SAXException
protected void setExceptions(Attributes attrs)
protected void finalizeExceptions()
protected void setToken(Attributes attrs) throws SAXException
SAXException
@Nullable protected List<Match> addLegacyMatches(List<Match> existingSugMatches, String messageStr, boolean inMessage)
protected void finalizeTokens(UnifierConfiguration unifierConfiguration) throws SAXException
SAXException
protected static void setRuleFilter(String filterClassName, String filterArgs, AbstractPatternRule rule)