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.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 boolean
private static final German
private static final Pattern
Fields 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 int
getCommaBehind
(org.languagetool.AnalyzedTokenReadings[] tokens, List<Integer> verbs, int start, int end) gives back position where a comma is missedprivate static String
getGender
(org.languagetool.AnalyzedTokenReadings token) get the gender of of a tokengetId()
private static String
getSinOrPluOfPro
(org.languagetool.AnalyzedTokenReadings token) checks if personal pronoun is singular or plural gives back null if token is not a personal pronounprivate 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 assumedprivate static boolean
isAnyVerb
(org.languagetool.AnalyzedTokenReadings[] tokens, int n) is any verb but not an "Infinitiv mit zu"private static boolean
check if token is potentially an articleprivate static boolean
isArticleWithoutSub
(String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int n) is the token a potential article without a nounprivate static boolean
isFourCombinedVerbs
(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int last) is a special combination of four verbs combinationprivate static boolean
isInfinitivZu
(org.languagetool.AnalyzedTokenReadings[] tokens, int last) is participle plus special combination of two verbs combinationprivate static boolean
isKonAfterVerb
(org.languagetool.AnalyzedTokenReadings[] tokens, int start, int end) conjunction follows last verbprivate static boolean
isKonUnt
(org.languagetool.AnalyzedTokenReadings token) first token initiate a subclauseprivate static boolean
isPar
(org.languagetool.AnalyzedTokenReadings token) is participleprivate static boolean
isPerfect
(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second) is a pair of verbs to build the perfectprivate static boolean
isPerfect
(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second, int third) is a pair of verbs to build the perfectprivate static boolean
isPronoun
(org.languagetool.AnalyzedTokenReadings[] tokens, int n) is potential relative pronounprivate static boolean
isPrp
(org.languagetool.AnalyzedTokenReadings token) is prepositionprivate static boolean
isSeparator
(String token) is a separatorprivate static boolean
isSeparatorOrInf
(org.languagetool.AnalyzedTokenReadings[] tokens, int n) is separator or VER:INFprivate static boolean
isSpecialInf
(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second, int start) is Infinitive in combination with substantivprivate static boolean
isSpecialPair
(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second) two infinitive verbs as pairprivate static boolean
isThreeCombinedVerbs
(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int last) is a special combination of three verbs combinationprivate static boolean
isTwoCombinedVerbs
(org.languagetool.AnalyzedTokenReadings first, org.languagetool.AnalyzedTokenReadings second) is a special combination of two verbs combinationprivate static boolean
isTwoPlusCombinedVerbs
(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int last) is verb plus special combination of two verbs combinationprivate static boolean
isVerb
(org.languagetool.AnalyzedTokenReadings[] tokens, int n) is a potential verb used in sentence or subclause(package private) static boolean
isVerbBehind
(org.languagetool.AnalyzedTokenReadings[] tokens, int end) is a verb after sub clauseprivate static boolean
isVerbProPair
(org.languagetool.AnalyzedTokenReadings[] tokens, int n) org.languagetool.rules.RuleMatch[]
match
(org.languagetool.AnalyzedSentence sentence) private static boolean
matchesGender
(String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int from, int to) does the gender match with a subject or name?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 separatelyprivate 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 separatelyprivate static int
nextSeparator
(org.languagetool.AnalyzedTokenReadings[] tokens, int start) get the position of the next separatorprivate static int
skipSub
(org.languagetool.AnalyzedTokenReadings[] tokens, int n, int to) skip tokens till the next noun check for e.g.private static int
skip 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:
getId
in classorg.languagetool.rules.Rule
-
getDescription
- Specified by:
getDescription
in 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
private static List<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
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
private static int getCommaBehind(org.languagetool.AnalyzedTokenReadings[] tokens, List<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
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:
match
in classorg.languagetool.rules.Rule
- Throws:
IOException
-
getAntiPatterns
public List<org.languagetool.tagging.disambiguation.rules.DisambiguationPatternRule> getAntiPatterns()- Overrides:
getAntiPatterns
in classorg.languagetool.rules.Rule
-