Class MissingCommaRelativeClauseRule
java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.de.MissingCommaRelativeClauseRule
public class MissingCommaRelativeClauseRule
extends org.languagetool.rules.Rule
A rule checks a sentence for a missing comma before or after a relative clause (only for German language)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate static final Germanprivate static final PatternFields inherited from class org.languagetool.rules.Rule
messages -
Constructor Summary
ConstructorsConstructorDescriptionMissingCommaRelativeClauseRule(ResourceBundle messages) MissingCommaRelativeClauseRule(ResourceBundle messages, boolean behind) -
Method Summary
Modifier and TypeMethodDescriptionList<org.languagetool.tagging.disambiguation.rules.DisambiguationPatternRule> private static intgetCommaBehind(org.languagetool.AnalyzedTokenReadings[] tokens, List<Integer> verbs, int start, int end) gives back position where a comma is missedprivate static StringgetGender(org.languagetool.AnalyzedTokenReadings token) get the gender of of a tokengetId()private static 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 booleancheck if token is potentially an articleprivate static booleanisArticleWithoutSub(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(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(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 intskip tokens till the next noun check for e.g.verbPos(org.languagetool.AnalyzedTokenReadings[] tokens, int start, int end) gives the positions of verbs in a subclauseMethods 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 Details
-
MARKS_REGEX
-
behind
private final boolean behind -
GERMAN
-
ANTI_PATTERNS
-
-
Constructor Details
-
MissingCommaRelativeClauseRule
-
MissingCommaRelativeClauseRule
-
-
Method Details
-
getId
- Specified by:
getIdin classorg.languagetool.rules.Rule
-
getDescription
- Specified by:
getDescriptionin classorg.languagetool.rules.Rule
-
isSeparator
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
-
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
get the gender of of a token -
matchesGender
private static boolean matchesGender(String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int from, int to) does the gender match with a subject or name? -
isArticleWithoutSub
private static boolean isArticleWithoutSub(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(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(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
-
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
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 IOException - Specified by:
matchin classorg.languagetool.rules.Rule- Throws:
IOException
-
getAntiPatterns
public List<org.languagetool.tagging.disambiguation.rules.DisambiguationPatternRule> getAntiPatterns()- Overrides:
getAntiPatternsin classorg.languagetool.rules.Rule
-