Search in sources :

Example 1 with GermanSpellerRule

use of org.languagetool.rules.de.GermanSpellerRule in project languagetool by languagetool-org.

the class AustrianGerman method getRelevantRules.

@Override
public List<Rule> getRelevantRules(ResourceBundle messages) throws IOException {
    List<Rule> rules = new ArrayList<>(super.getRelevantRules(messages));
    rules.add(new GermanSpellerRule(messages, this));
    return rules;
}
Also used : ArrayList(java.util.ArrayList) GermanSpellerRule(org.languagetool.rules.de.GermanSpellerRule) Rule(org.languagetool.rules.Rule) GermanSpellerRule(org.languagetool.rules.de.GermanSpellerRule)

Example 2 with GermanSpellerRule

use of org.languagetool.rules.de.GermanSpellerRule in project languagetool by languagetool-org.

the class GermanyGerman method getRelevantRules.

@Override
public List<Rule> getRelevantRules(ResourceBundle messages) throws IOException {
    List<Rule> rules = new ArrayList<>(super.getRelevantRules(messages));
    rules.add(new GermanSpellerRule(messages, this));
    return rules;
}
Also used : ArrayList(java.util.ArrayList) GermanSpellerRule(org.languagetool.rules.de.GermanSpellerRule) Rule(org.languagetool.rules.Rule) GermanSpellerRule(org.languagetool.rules.de.GermanSpellerRule)

Example 3 with GermanSpellerRule

use of org.languagetool.rules.de.GermanSpellerRule in project languagetool by languagetool-org.

the class SwissGerman method getRelevantRules.

@Override
public List<Rule> getRelevantRules(ResourceBundle messages) throws IOException {
    List<Rule> rules = new ArrayList<>(super.getRelevantRules(messages));
    rules.add(new GermanSpellerRule(messages, this));
    return rules;
}
Also used : ArrayList(java.util.ArrayList) GermanSpellerRule(org.languagetool.rules.de.GermanSpellerRule) Rule(org.languagetool.rules.Rule) GermanSpellerRule(org.languagetool.rules.de.GermanSpellerRule)

Example 4 with GermanSpellerRule

use of org.languagetool.rules.de.GermanSpellerRule in project languagetool by languagetool-org.

the class HunspellRuleTest method testCompoundAwareRulePerformance.

@Ignore("just for internal performance testing, thus ignored by default")
@Test
public void testCompoundAwareRulePerformance() throws IOException {
    ResourceBundle messages = ResourceBundle.getBundle("org.languagetool.MessagesBundle", new Locale("de"));
    //slow:
    //HunspellRule rule = new HunspellRule(messages, Language.GERMANY_GERMAN);
    //fast:
    CompoundAwareHunspellRule rule = new GermanSpellerRule(messages, new GermanyGerman());
    rule.init();
    String[] words = { "foo", "warmup", "Rechtschreipreform", "Theatrekasse", "Zoobesuck", "Handselvertreter", "Mückenstick", "gewönlich", "Traprennen", "Autoverkehrr" };
    for (String word : words) {
        long startTime = System.currentTimeMillis();
        List<String> suggest = rule.getSuggestions(word);
        System.out.println((System.currentTimeMillis() - startTime) + "ms for " + word + ": " + suggest);
    }
}
Also used : Locale(java.util.Locale) ResourceBundle(java.util.ResourceBundle) GermanSpellerRule(org.languagetool.rules.de.GermanSpellerRule) GermanyGerman(org.languagetool.language.GermanyGerman) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

GermanSpellerRule (org.languagetool.rules.de.GermanSpellerRule)4 ArrayList (java.util.ArrayList)3 Rule (org.languagetool.rules.Rule)3 Locale (java.util.Locale)1 ResourceBundle (java.util.ResourceBundle)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 GermanyGerman (org.languagetool.language.GermanyGerman)1