Class VerbAgreementRule
java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.TextLevelRule
org.languagetool.rules.de.VerbAgreementRule
public class VerbAgreementRule
extends org.languagetool.rules.TextLevelRule
Simple agreement checker for German verbs and subject. Checks agreement in:
- VER:1:SIN w/o ich: e.g. "Max bin da." (incorrect) [same for VER:2:SIN w/o du, VER:1:PLU w/o wir]
- ich + VER:[123]:.* (not VER:1:SIN): e.g. "ich bist" (incorrect) [same for du, er, wir]
- wenn nur ein mögliches finites Verb -> das nehmen (Max machen das.)
- Sie (i>1)
- bei ich/du/er/wir sofort prüfen, damit alle vorkommen geprüft werden (Ich geht jetzt nach Hause und dort gehe ich sofort unter die Dusche.) [aber: isNear]
- Alle Verbvorkommen merken (Er präsentieren wollte und Video hätte keine Pläne.)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class -
Field Summary
FieldsFields inherited from class org.languagetool.rules.Rule
messages -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<org.languagetool.tagging.disambiguation.rules.DisambiguationPatternRule> getId()getPronounSuggestions(org.languagetool.AnalyzedTokenReadings verb, boolean toUppercase) getVerbSuggestions(org.languagetool.AnalyzedTokenReadings verb, String expectedVerbPOS, boolean toUppercase) private booleanhasUnambiguouslyPersonAndNumber(org.languagetool.AnalyzedTokenReadings tokenReadings, String person, String number) private booleanisFiniteVerb(org.languagetool.AnalyzedTokenReadings token) private booleanisNear(int a, int b) private booleanisQuotationMark(org.languagetool.AnalyzedTokenReadings token) org.languagetool.rules.RuleMatch[]private List<org.languagetool.rules.RuleMatch> match(org.languagetool.AnalyzedSentence sentence, int pos) intprivate booleannextButOneIsModal(org.languagetool.AnalyzedTokenReadings[] tokens, int pos) private org.languagetool.rules.RuleMatchruleMatchWrongVerb(org.languagetool.AnalyzedTokenReadings token, int pos, org.languagetool.AnalyzedSentence sentence) private org.languagetool.rules.RuleMatchruleMatchWrongVerbSubject(org.languagetool.AnalyzedTokenReadings subject, org.languagetool.AnalyzedTokenReadings verb, String expectedVerbPOS, int pos, org.languagetool.AnalyzedSentence sentence) verbDoesMatchPersonAndNumber(org.languagetool.AnalyzedTokenReadings token1, org.languagetool.AnalyzedTokenReadings token2, String person, String number, org.languagetool.AnalyzedTokenReadings finiteVerb) Methods inherited from class org.languagetool.rules.TextLevelRule
estimateContextForSureMatch, match, matchMethods inherited from class org.languagetool.rules.Rule
addExamplePair, getCategory, getConfigureText, getCorrectExamples, getDefaultValue, getErrorTriggeringExamples, getIncorrectExamples, getLocQualityIssueType, getMaxConfigurableValue, getMinConfigurableValue, getSentenceWithImmunization, getUrl, hasConfigurableValue, isDefaultOff, isDefaultTempOff, isDictionaryBasedSpellingRule, isOfficeDefaultOff, isOfficeDefaultOn, makeAntiPatterns, setCategory, setCorrectExamples, setDefaultOff, setDefaultOn, setDefaultTempOff, setErrorTriggeringExamples, setIncorrectExamples, setLocQualityIssueType, setOfficeDefaultOff, setOfficeDefaultOn, setUrl, supportsLanguage, toRuleMatchArray, useInOffice
-
Field Details
-
ANTI_PATTERNS
-
BIN_IGNORE
-
CONJUNCTIONS
-
QUOTATION_MARKS
-
language
-
-
Constructor Details
-
VerbAgreementRule
-
-
Method Details
-
getId
- Specified by:
getIdin classorg.languagetool.rules.Rule
-
getDescription
- Specified by:
getDescriptionin classorg.languagetool.rules.Rule
-
match
- Specified by:
matchin classorg.languagetool.rules.TextLevelRule
-
match
private List<org.languagetool.rules.RuleMatch> match(org.languagetool.AnalyzedSentence sentence, int pos) -
getAntiPatterns
public List<org.languagetool.tagging.disambiguation.rules.DisambiguationPatternRule> getAntiPatterns()- Overrides:
getAntiPatternsin classorg.languagetool.rules.Rule
-
nextButOneIsModal
private boolean nextButOneIsModal(org.languagetool.AnalyzedTokenReadings[] tokens, int pos) -
isNear
private boolean isNear(int a, int b) - Returns:
- true if |a - b| invalid input: '<' 5, and a != -1
-
isQuotationMark
private boolean isQuotationMark(org.languagetool.AnalyzedTokenReadings token) -
hasUnambiguouslyPersonAndNumber
-
isFiniteVerb
private boolean isFiniteVerb(org.languagetool.AnalyzedTokenReadings token) - Returns:
- true if @param token is a finite verb, and it is no participle, pronoun or number
-
verbDoesMatchPersonAndNumber
private VerbAgreementRule.BooleanAndFiniteVerb verbDoesMatchPersonAndNumber(org.languagetool.AnalyzedTokenReadings token1, org.languagetool.AnalyzedTokenReadings token2, String person, String number, org.languagetool.AnalyzedTokenReadings finiteVerb) - Returns:
- false if neither the verb @param token1 (if any) nor @param token2 match @param person and @param number, and none of them is "und" or "," if a finite verb is found, it is saved in finiteVerb
-
getVerbSuggestions
-
getPronounSuggestions
-
ruleMatchWrongVerb
private org.languagetool.rules.RuleMatch ruleMatchWrongVerb(org.languagetool.AnalyzedTokenReadings token, int pos, org.languagetool.AnalyzedSentence sentence) -
ruleMatchWrongVerbSubject
private org.languagetool.rules.RuleMatch ruleMatchWrongVerbSubject(org.languagetool.AnalyzedTokenReadings subject, org.languagetool.AnalyzedTokenReadings verb, String expectedVerbPOS, int pos, org.languagetool.AnalyzedSentence sentence) -
minToCheckParagraph
public int minToCheckParagraph()- Specified by:
minToCheckParagraphin classorg.languagetool.rules.TextLevelRule
-