Package org.languagetool.rules.de
Class MissingCommaRelativeClauseRule
- java.lang.Object
-
- org.languagetool.rules.Rule
-
- org.languagetool.rules.de.MissingCommaRelativeClauseRule
-
public class MissingCommaRelativeClauseRule extends org.languagetool.rules.RuleA rule checks a sentence for a missing comma before or after a relative clause (only for German language)
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<java.util.List<org.languagetool.rules.patterns.PatternToken>>ANTI_PATTERNSprivate booleanbehindprivate static GermanGERMANprivate static java.util.regex.PatternMARKS_REGEX
-
Constructor Summary
Constructors Constructor Description MissingCommaRelativeClauseRule(java.util.ResourceBundle messages)MissingCommaRelativeClauseRule(java.util.ResourceBundle messages, boolean behind)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<org.languagetool.tagging.disambiguation.rules.DisambiguationPatternRule>getAntiPatterns()private static intgetCommaBehind(org.languagetool.AnalyzedTokenReadings[] tokens, java.util.List<java.lang.Integer> verbs, int start, int end)gives back position where a comma is missedjava.lang.StringgetDescription()private static java.lang.StringgetGender(org.languagetool.AnalyzedTokenReadings token)get the gender of of a tokenjava.lang.StringgetId()private static java.lang.StringgetSinOrPluOfPro(org.languagetool.AnalyzedTokenReadings token)checks if personal pronoun is singular or plural gives back null if token is not a personal pronounprivate static inthasPotentialSubclause(org.languagetool.AnalyzedTokenReadings[] tokens, int start, int end)checks to what position a test of relative clause should done return -1 if no potential relative clause is assumedprivate static booleanisAnyVerb(org.languagetool.AnalyzedTokenReadings[] tokens, int n)is any verb but not an "Infinitiv mit zu"private static booleanisArticle(java.lang.String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int from, int to)check if token is potentially an articleprivate static booleanisArticleWithoutSub(java.lang.String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int n)is the token a potential article without a nounprivate static booleanisFourCombinedVerbs(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int last)is a special combination of four verbs combinationprivate static booleanisInfinitivZu(org.languagetool.AnalyzedTokenReadings[] tokens, int last)is participle plus special combination of two verbs combinationprivate static booleanisKonAfterVerb(org.languagetool.AnalyzedTokenReadings[] tokens, int start, int end)conjunction follows last verbprivate static booleanisKonUnt(org.languagetool.AnalyzedTokenReadings token)first token initiate a subclauseprivate static booleanisPar(org.languagetool.AnalyzedTokenReadings token)is participleprivate static booleanisPerfect(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second)is a pair of verbs to build the perfectprivate static booleanisPerfect(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second, int third)is a pair of verbs to build the perfectprivate static booleanisPronoun(org.languagetool.AnalyzedTokenReadings[] tokens, int n)is potential relative pronounprivate static booleanisPrp(org.languagetool.AnalyzedTokenReadings token)is prepositionprivate static booleanisSeparator(java.lang.String token)is a separatorprivate static booleanisSeparatorOrInf(org.languagetool.AnalyzedTokenReadings[] tokens, int n)is separator or VER:INFprivate static booleanisSpecialInf(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second, int start)is Infinitive in combination with substantivprivate static booleanisSpecialPair(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second)two infinitive verbs as pairprivate static booleanisThreeCombinedVerbs(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int last)is a special combination of three verbs combinationprivate static booleanisTwoCombinedVerbs(org.languagetool.AnalyzedTokenReadings first, org.languagetool.AnalyzedTokenReadings second)is a special combination of two verbs combinationprivate static booleanisTwoPlusCombinedVerbs(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int last)is verb plus special combination of two verbs combinationprivate static booleanisVerb(org.languagetool.AnalyzedTokenReadings[] tokens, int n)is a potential verb used in sentence or subclause(package private) static booleanisVerbBehind(org.languagetool.AnalyzedTokenReadings[] tokens, int end)is a verb after sub clauseprivate static booleanisVerbProPair(org.languagetool.AnalyzedTokenReadings[] tokens, int n)org.languagetool.rules.RuleMatch[]match(org.languagetool.AnalyzedSentence sentence)private static booleanmatchesGender(java.lang.String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int from, int to)does the gender match with a subject or name?private static intmissedCommaBehind(org.languagetool.AnalyzedTokenReadings[] tokens, int inFront, int start, int end)gives back position where a comma is missed PRP has to be treated separatelyprivate static intmissedCommaInFront(org.languagetool.AnalyzedTokenReadings[] tokens, int start, int end, int lastVerb)gives back position where a comma is missed PRP has to be treated separatelyprivate static intnextSeparator(org.languagetool.AnalyzedTokenReadings[] tokens, int start)get the position of the next separatorprivate static intskipSub(org.languagetool.AnalyzedTokenReadings[] tokens, int n, int to)skip tokens till the next noun check for e.g.private static intskipToSub(java.lang.String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int n, int to)skip tokens till the next noun check for e.g.private static java.util.List<java.lang.Integer>verbPos(org.languagetool.AnalyzedTokenReadings[] tokens, int start, int end)gives the positions of verbs in a subclause-
Methods inherited from class org.languagetool.rules.Rule
addExamplePair, estimateContextForSureMatch, 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 Detail
-
MARKS_REGEX
private static final java.util.regex.Pattern MARKS_REGEX
-
behind
private final boolean behind
-
GERMAN
private static final German GERMAN
-
ANTI_PATTERNS
private static final java.util.List<java.util.List<org.languagetool.rules.patterns.PatternToken>> ANTI_PATTERNS
-
-
Method Detail
-
getId
public java.lang.String getId()
- Specified by:
getIdin classorg.languagetool.rules.Rule
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescriptionin classorg.languagetool.rules.Rule
-
isSeparator
private static boolean isSeparator(java.lang.String token)
is a separator
-
nextSeparator
private static int nextSeparator(org.languagetool.AnalyzedTokenReadings[] tokens, int start)get the position of the next separator
-
isPrp
private static boolean isPrp(org.languagetool.AnalyzedTokenReadings token)
is preposition
-
isVerb
private static boolean isVerb(org.languagetool.AnalyzedTokenReadings[] tokens, int n)is a potential verb used in sentence or subclause
-
isAnyVerb
private static boolean isAnyVerb(org.languagetool.AnalyzedTokenReadings[] tokens, int n)is any verb but not an "Infinitiv mit zu"
-
isVerbBehind
static boolean isVerbBehind(org.languagetool.AnalyzedTokenReadings[] tokens, int end)is a verb after sub clause
-
verbPos
private static java.util.List<java.lang.Integer> verbPos(org.languagetool.AnalyzedTokenReadings[] tokens, int start, int end)gives the positions of verbs in a subclause
-
isKonUnt
private static boolean isKonUnt(org.languagetool.AnalyzedTokenReadings token)
first token initiate a subclause
-
hasPotentialSubclause
private static int hasPotentialSubclause(org.languagetool.AnalyzedTokenReadings[] tokens, int start, int end)checks to what position a test of relative clause should done return -1 if no potential relative clause is assumed
-
isPronoun
private static boolean isPronoun(org.languagetool.AnalyzedTokenReadings[] tokens, int n)is potential relative pronoun
-
getGender
private static java.lang.String getGender(org.languagetool.AnalyzedTokenReadings token)
get the gender of of a token
-
matchesGender
private static boolean matchesGender(java.lang.String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int from, int to)does the gender match with a subject or name?
-
isArticleWithoutSub
private static boolean isArticleWithoutSub(java.lang.String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int n)is the token a potential article without a noun
-
skipSub
private static int skipSub(org.languagetool.AnalyzedTokenReadings[] tokens, int n, int to)skip tokens till the next noun check for e.g. "das in die dunkle Garage fahrende Auto" -> "das" is article
-
skipToSub
private static int skipToSub(java.lang.String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int n, int to)skip tokens till the next noun check for e.g. "das in die dunkle Garage fahrende Auto" -> "das" is article
-
isArticle
private static boolean isArticle(java.lang.String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int from, int to)check if token is potentially an article
-
missedCommaInFront
private static int missedCommaInFront(org.languagetool.AnalyzedTokenReadings[] tokens, int start, int end, int lastVerb)gives back position where a comma is missed PRP has to be treated separately
-
isTwoCombinedVerbs
private static boolean isTwoCombinedVerbs(org.languagetool.AnalyzedTokenReadings first, org.languagetool.AnalyzedTokenReadings second)is a special combination of two verbs combination
-
isThreeCombinedVerbs
private static boolean isThreeCombinedVerbs(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int last)is a special combination of three verbs combination
-
isFourCombinedVerbs
private static boolean isFourCombinedVerbs(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int last)is a special combination of four verbs combination
-
isPar
private static boolean isPar(org.languagetool.AnalyzedTokenReadings token)
is participle
-
isInfinitivZu
private static boolean isInfinitivZu(org.languagetool.AnalyzedTokenReadings[] tokens, int last)is participle plus special combination of two verbs combination
-
isTwoPlusCombinedVerbs
private static boolean isTwoPlusCombinedVerbs(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int last)is verb plus special combination of two verbs combination
-
isKonAfterVerb
private static boolean isKonAfterVerb(org.languagetool.AnalyzedTokenReadings[] tokens, int start, int end)conjunction follows last verb
-
isSpecialPair
private static boolean isSpecialPair(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second)two infinitive verbs as pair
-
isPerfect
private static boolean isPerfect(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second)is a pair of verbs to build the perfect
-
isSpecialInf
private static boolean isSpecialInf(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second, int start)is Infinitive in combination with substantiv
-
isPerfect
private static boolean isPerfect(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second, int third)is a pair of verbs to build the perfect
-
isSeparatorOrInf
private static boolean isSeparatorOrInf(org.languagetool.AnalyzedTokenReadings[] tokens, int n)is separator or VER:INF
-
getCommaBehind
private static int getCommaBehind(org.languagetool.AnalyzedTokenReadings[] tokens, java.util.List<java.lang.Integer> verbs, int start, int end)gives back position where a comma is missed
-
missedCommaBehind
private static int missedCommaBehind(org.languagetool.AnalyzedTokenReadings[] tokens, int inFront, int start, int end)gives back position where a comma is missed PRP has to be treated separately
-
getSinOrPluOfPro
private static java.lang.String getSinOrPluOfPro(org.languagetool.AnalyzedTokenReadings token)
checks if personal pronoun is singular or plural gives back null if token is not a personal pronoun
-
isVerbProPair
private static boolean isVerbProPair(org.languagetool.AnalyzedTokenReadings[] tokens, int n)
-
match
public org.languagetool.rules.RuleMatch[] match(org.languagetool.AnalyzedSentence sentence) throws java.io.IOException- Specified by:
matchin classorg.languagetool.rules.Rule- Throws:
java.io.IOException
-
getAntiPatterns
public java.util.List<org.languagetool.tagging.disambiguation.rules.DisambiguationPatternRule> getAntiPatterns()
- Overrides:
getAntiPatternsin classorg.languagetool.rules.Rule
-
-