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

    Fields
    Modifier and Type
    Field
    Description
    private static final List<List<org.languagetool.rules.patterns.PatternToken>>
     
    private final boolean
     
    private static final German
     
    private static final Pattern
     

    Fields inherited from class org.languagetool.rules.Rule

    messages
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<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 missed
     
    private static String
    getGender(org.languagetool.AnalyzedTokenReadings token)
    get the gender of of a token
     
    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 pronoun
    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
    private static boolean
    isAnyVerb(org.languagetool.AnalyzedTokenReadings[] tokens, int n)
    is any verb but not an "Infinitiv mit zu"
    private static boolean
    isArticle(String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int from, int to)
    check if token is potentially an article
    private static boolean
    isArticleWithoutSub(String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int n)
    is the token a potential article without a noun
    private static boolean
    isFourCombinedVerbs(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int last)
    is a special combination of four verbs combination
    private static boolean
    isInfinitivZu(org.languagetool.AnalyzedTokenReadings[] tokens, int last)
    is participle plus special combination of two verbs combination
    private static boolean
    isKonAfterVerb(org.languagetool.AnalyzedTokenReadings[] tokens, int start, int end)
    conjunction follows last verb
    private static boolean
    isKonUnt(org.languagetool.AnalyzedTokenReadings token)
    first token initiate a subclause
    private static boolean
    isPar(org.languagetool.AnalyzedTokenReadings token)
    is participle
    private static boolean
    isPerfect(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second)
    is a pair of verbs to build the perfect
    private static boolean
    isPerfect(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second, int third)
    is a pair of verbs to build the perfect
    private static boolean
    isPronoun(org.languagetool.AnalyzedTokenReadings[] tokens, int n)
    is potential relative pronoun
    private static boolean
    isPrp(org.languagetool.AnalyzedTokenReadings token)
    is preposition
    private static boolean
    is a separator
    private static boolean
    isSeparatorOrInf(org.languagetool.AnalyzedTokenReadings[] tokens, int n)
    is separator or VER:INF
    private static boolean
    isSpecialInf(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second, int start)
    is Infinitive in combination with substantiv
    private static boolean
    isSpecialPair(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int second)
    two infinitive verbs as pair
    private static boolean
    isThreeCombinedVerbs(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int last)
    is a special combination of three verbs combination
    private static boolean
    isTwoCombinedVerbs(org.languagetool.AnalyzedTokenReadings first, org.languagetool.AnalyzedTokenReadings second)
    is a special combination of two verbs combination
    private static boolean
    isTwoPlusCombinedVerbs(org.languagetool.AnalyzedTokenReadings[] tokens, int first, int last)
    is verb plus special combination of two verbs combination
    private 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 clause
    private 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 separately
    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
    private static int
    nextSeparator(org.languagetool.AnalyzedTokenReadings[] tokens, int start)
    get the position of the next separator
    private static int
    skipSub(org.languagetool.AnalyzedTokenReadings[] tokens, int n, int to)
    skip tokens till the next noun check for e.g.
    private static int
    skipToSub(String gender, org.languagetool.AnalyzedTokenReadings[] tokens, int n, int to)
    skip tokens till the next noun check for e.g.
    private static List<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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MARKS_REGEX

      private static final Pattern MARKS_REGEX
    • behind

      private final boolean behind
    • GERMAN

      private static final German GERMAN
    • ANTI_PATTERNS

      private static final List<List<org.languagetool.rules.patterns.PatternToken>> ANTI_PATTERNS
  • Constructor Details

    • MissingCommaRelativeClauseRule

      public MissingCommaRelativeClauseRule(ResourceBundle messages)
    • MissingCommaRelativeClauseRule

      public MissingCommaRelativeClauseRule(ResourceBundle messages, boolean behind)
  • Method Details

    • getId

      public String getId()
      Specified by:
      getId in class org.languagetool.rules.Rule
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in class org.languagetool.rules.Rule
    • isSeparator

      private static boolean isSeparator(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 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

      private static String getGender(org.languagetool.AnalyzedTokenReadings token)
      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

      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 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 class org.languagetool.rules.Rule
      Throws:
      IOException
    • getAntiPatterns

      public List<org.languagetool.tagging.disambiguation.rules.DisambiguationPatternRule> getAntiPatterns()
      Overrides:
      getAntiPatterns in class org.languagetool.rules.Rule