Package org.languagetool.rules.patterns
Class PatternRuleHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.languagetool.rules.patterns.XMLRuleHandler
org.languagetool.rules.patterns.PatternRuleHandler
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
- Direct Known Subclasses:
BitextPatternRuleHandler
-
Nested Class Summary
Nested classes/interfaces inherited from class org.languagetool.rules.patterns.XMLRuleHandler
XMLRuleHandler.RegexpMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprotected Categoryprotected Stringprivate booleanprivate booleanprivate intprivate intprivate static final Stringprotected Stringprotected Stringprivate Stringprivate booleanprivate booleanprivate booleanprivate booleanprivate boolean(package private) static final Stringprivate intprotected String(package private) static final String(package private) static final Stringprivate booleanprivate final List<DisambiguationPatternRule> private final List<DisambiguationPatternRule> private booleanprivate booleanprivate Stringprivate intprotected Stringprivate intprotected Stringprotected final Stringprivate intprivate intprivate intstatic final StringFields inherited from class org.languagetool.rules.patterns.XMLRuleHandler
AND, andGroupCounter, ANTIPATTERN, antiPatternExample, antipatternExamples, antiPatternForRuleGroupExample, antipatternForRuleGroupsExamples, CASE_SENSITIVE, caseSensitive, categoryTags, categoryToneTags, chunkTag, CHUNKTAG, CHUNKTAG_REGEXP, correctExample, correctExamples, DEFAULT, DISTANCETOKENS, elements, endPositionCorrection, equivalenceFeatures, errorTriggerExample, errorTriggeringExamples, EXAMPLE, exampleCorrection, EXCEPTION, exceptionLevelCaseSensitive, exceptionLevelCaseSet, exceptionPosNegation, exceptionPosRegExp, exceptionPosToken, exceptions, exceptionSet, exceptionSpaceBefore, exceptionSpaceBeforeSet, exceptionStringInflected, exceptionStringNegation, exceptionStringRegExp, exceptionValidNext, exceptionValidPrev, FALSE, FEATURE, GOAL_SPECIFIC, id, ID, IGNORE, inAndGroup, inAntiPatternExample, inAntiPatternForRuleGroupExample, incorrectExample, inCorrectExample, incorrectExamples, inErrorTriggerExample, inException, INFLECTED, inIncorrectExample, inMarker, inMatch, inMessage, inOrGroup, inPattern, inPhrases, inRegex, inRuleGroup, inShortMessage, inShortMessageForRuleGroup, inSuggestion, inToken, inUnification, inUnificationDef, inUnificationNeutral, inUrl, inUrlForRuleGroup, isGoalSpecific, isGoalSpecificCategoryAttribute, isGoalSpecificRuleGroupAttribute, isPremiumRule, language, lastPhrase, MARK, MARKER, match, MATCH, MAX, maxOccurrence, message, MESSAGE, messages, MIN, minOccurrence, MINPREVMATCHES, NAME, NEGATE, NEGATE_POS, NO, OFF, ON, OR, orGroupCounter, PATTERN, patternToken, patternTokens, phraseId, phraseIdRef, phraseMap, phrasePatternTokens, PHRASES, pLocator, posNegation, posRegExp, POSTAG, POSTAG_REGEXP, posToken, PREMIUM, premiumCategoryAttribute, premiumFileAttribute, premiumRuleGroupAttribute, PRIO, prioCategoryAttribute, prioRuleAttribute, prioRuleGroupAttribute, regex, regexCaseSensitive, regexMode, REGEXP, regexpMark, regExpression, RULE, RULEGROUP, ruleGroupId, ruleGroupTags, ruleGroupToneTags, rules, RULES, ruleTags, ruleToneTags, SCOPE, shortMessage, shortMessageForRuleGroup, SKIP, skipPos, SPACEBEFORE, startPositionCorrection, SUGGESTION, suggestionMatches, suggestionMatchesOutMsg, suggestionsOutMsg, TABNAME, TEMP_OFF, TOKEN, tokenCounter, tokenInflected, tokenLevelCaseSensitive, tokenLevelCaseSet, tokenNegated, tokenReference, tokenSpaceBefore, tokenSpaceBeforeSet, TRUE, uFeature, UNIFICATION, UNIFY, UNIFY_IGNORE, uniNegation, url, urlForRuleGroup, uType, uTypeList, xmlLineNumber, xmlLineNumberAntiPattern, YES -
Constructor Summary
ConstructorsConstructorDescriptionPatternRuleHandler(String sourceFile) PatternRuleHandler(String filename, Language lang) -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] buf, int offset, int len) private voidcreateRules(List<PatternToken> elemList, List<PatternToken> tmpPatternTokens, int numElement) Create rule from an Element list.voidendElement(String namespaceURI, String sName, String qName) private URLprotected void(package private) StringresolveEntity(String publicId, String systemId) (package private) voidsetRelaxedMode(boolean relaxedMode) If set to true, don't throw an exception if id or name is not set.voidstartElement(String namespaceURI, String lName, String qName, Attributes attrs) Methods inherited from class org.languagetool.rules.patterns.XMLRuleHandler
addLegacyMatches, error, finalizeExceptions, finalizePhrase, finalizeTokens, getRules, preparePhrase, processElement, resetException, resetToken, setDocumentLocator, setExceptions, setMatchElement, setRuleFilter, setToken, startPattern, warningMethods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDeclMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
TYPE
- See Also:
-
MARKER_TAG
- See Also:
-
RAW_TAG
- See Also:
-
PLEASE_SPELL_ME
- See Also:
-
EXTERNAL
- See Also:
-
sourceFile
-
category
-
categoryIssueType
-
ruleGroupIssueType
-
ruleIssueType
-
name
-
filterClassName
-
filterArgs
-
rulegroupAntiPatterns
-
ruleAntiPatterns
-
subId
private int subId -
interpretPosTagsPreDisambiguation
private boolean interpretPosTagsPreDisambiguation -
defaultOff
private boolean defaultOff -
defaultTempOff
private boolean defaultTempOff -
ruleGroupDefaultOff
private boolean ruleGroupDefaultOff -
ruleGroupDefaultTempOff
private boolean ruleGroupDefaultTempOff -
ruleGroupDescription
-
startPos
private int startPos -
endPos
private int endPos -
tokenCountForMarker
private int tokenCountForMarker -
antiPatternCounter
private int antiPatternCounter -
inRule
private boolean inRule -
relaxedMode
private boolean relaxedMode -
inAntiPattern
private boolean inAntiPattern -
isRuleSuppressMisspelled
private boolean isRuleSuppressMisspelled -
isSuggestionSuppressMisspelled
private boolean isSuggestionSuppressMisspelled -
minPrevMatches
private int minPrevMatches -
ruleGroupMinPrevMatches
private int ruleGroupMinPrevMatches -
distanceTokens
private int distanceTokens -
ruleGroupDistanceTokens
private int ruleGroupDistanceTokens -
idPrefix
-
internedUrls
-
-
Constructor Details
-
PatternRuleHandler
public PatternRuleHandler() -
PatternRuleHandler
-
PatternRuleHandler
-
-
Method Details
-
resolveEntity
- Specified by:
resolveEntityin interfaceEntityResolver- Overrides:
resolveEntityin classDefaultHandler- Throws:
IOExceptionSAXException
-
setRelaxedMode
void setRelaxedMode(boolean relaxedMode) If set to true, don't throw an exception if id or name is not set. Used for online rule editor.- Since:
- 2.1
-
startElement
public void startElement(String namespaceURI, String lName, String qName, Attributes attrs) throws SAXException - Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
createRules
private void createRules(List<PatternToken> elemList, List<PatternToken> tmpPatternTokens, int numElement) Create rule from an Element list. In case of OR groups, several rules are created recursively.- Parameters:
elemList- The complete original Element listtmpPatternTokens- Temporary list being creatednumElement- Index of elemList being analyzed- Since:
- 2.3
-
replaceSpacesInRegex
-
prepareRule
-
internUrl
- Throws:
MalformedURLException
-
characters
public void characters(char[] buf, int offset, int len) - Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler
-