Package org.languagetool.language

Examples of org.languagetool.language.AmericanEnglish


    assertEquals(1, match.getLine());
    assertEquals(15, match.getColumn());
  }

  public void testPositionsWithEnglishTwoLineBreaks() throws IOException {
    final JLanguageTool tool = new JLanguageTool(new AmericanEnglish());
    final List<RuleMatch> matches = tool.check("This sentence.\n\n" +
        "A sentence. A typoh.");
    assertEquals(1, matches.size());
    final RuleMatch match = matches.get(0);
    assertEquals(2, match.getLine());
View Full Code Here


import org.languagetool.language.AmericanEnglish;

public class AmericanEnglishConcurrencyTest extends AbstractLanguageConcurrencyTest {
  @Override
  protected Language createLanguage() {
    return new AmericanEnglish();
  }
View Full Code Here

    langTool = new JLanguageTool(language);
  }

  @Test
  public void testSuggestions() throws IOException {
    Language language = new AmericanEnglish();
    Rule rule = new MorfologikAmericanSpellerRule(TestTools.getMessages("en"), language);
    super.testNonVariantSpecificSuggestions(rule, language);
  }
View Full Code Here

import java.util.List;

public class SpellingCheckRuleTest extends TestCase {

  public void testIgnoreSuggestionsWithMorfologik() throws IOException {
    final JLanguageTool langTool = new JLanguageTool(new AmericanEnglish());

    final List<RuleMatch> matches = langTool.check("This is anArtificialTestWordForLanguageTool.");
    assertEquals(0, matches.size());   // no error, as this word is in ignore.txt

    final List<RuleMatch> matches2 = langTool.check("This is a real typoh.");
View Full Code Here

    assertEquals(1, matches2.size());
    assertEquals("MORFOLOGIK_RULE_EN_US", matches2.get(0).getRule().getId());
  }

  public void testIgnoreSuggestionsWithDynamicMorfologikRule() throws IOException {
    final JLanguageTool langTool = new JLanguageTool(new AmericanEnglish());
    final SpellingCheckRule rule = new MorfologikAmericanSpellerRule(TestTools.getEnglishMessages(), new AmericanEnglish());
    langTool.addRule(rule);
    final List<RuleMatch> matches = langTool.check("This is a typoh.");
    assertEquals(1, matches.size());
    assertEquals(MorfologikAmericanSpellerRule.RULE_ID, matches.get(0).getRule().getId());

    final PatternRule ruleWithSuggestion = new PatternRule("TEST_ID", new AmericanEnglish(),
            Collections.<Element>emptyList(), "description",
            "Did you mean <suggestion>typoh</suggestion>?", null);
    langTool.addRule(ruleWithSuggestion);
    final List<RuleMatch> matches2 = langTool.check("This is a typoh.");
    assertEquals(0, matches2.size());   // no error anymore, as this is a suggestion
View Full Code Here

TOP

Related Classes of org.languagetool.language.AmericanEnglish

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.