Package org.languagetool.language

Examples of org.languagetool.language.AmericanEnglish


    tool.disableCategory("Possible Typos");
    assertEquals(0, tool.check("I've go to go.").size());
  }
 
  public void testPositionsWithEnglish() throws IOException {
    final JLanguageTool tool = new JLanguageTool(new AmericanEnglish());
    final List<RuleMatch> matches = tool.check("A sentence with no period\n" +
            "A sentence. A typoh.");
    assertEquals(1, matches.size());
    final RuleMatch match = matches.get(0);
    assertEquals(1, match.getLine());
View Full Code Here


    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

public class MorfologikAmericanSpellerRuleTest {

  @Test
  public void testMorfologikSpeller() throws IOException {
    final AmericanEnglish language = new AmericanEnglish();
    final MorfologikAmericanSpellerRule rule =
            new MorfologikAmericanSpellerRule (TestTools.getMessages("English"), language);

    final JLanguageTool langTool = new JLanguageTool(language);
View Full Code Here

    assertThat(bundle1.getString("de"), is("Deutsch"));

    final ResourceBundle bundle2 = JLanguageTool.getMessageBundle(new English());
    assertThat(bundle2.getString("de"), is("German"));

    final ResourceBundle bundle3 = JLanguageTool.getMessageBundle(new AmericanEnglish());
    assertThat(bundle3.getString("de"), is("German"));
  }
View Full Code Here

    assertThat(bundle1.getString("de"), is("Deutsch"));

    final ResourceBundle bundle2 = JLanguageTool.getMessageBundle(english);
    assertThat(bundle2.getString("de"), is("German"));

    final ResourceBundle bundle3 = JLanguageTool.getMessageBundle(new AmericanEnglish());
    assertThat(bundle3.getString("de"), is("German"));
  }
View Full Code Here

  }

  @Test
  public void testRuleFileName() {
    assertEquals("[/org/languagetool/rules/en/grammar.xml, /org/languagetool/rules/en/en-GB/grammar.xml]", new BritishEnglish().getRuleFileNames().toString());
    assertEquals("[/org/languagetool/rules/en/grammar.xml, /org/languagetool/rules/en/en-US/grammar.xml]", new AmericanEnglish().getRuleFileNames().toString());
    assertEquals("[/org/languagetool/rules/en/grammar.xml]", new English().getRuleFileNames().toString());
    assertEquals("[/org/languagetool/rules/de/grammar.xml]", new German().getRuleFileNames().toString());
  }
View Full Code Here

    assertEquals("Deutsch (Schweiz)", new SwissGerman().getTranslatedName(TestTools.getMessages("de")));
  }

  @Test
  public void testGetShortNameWithVariant() {
    assertEquals("en-US", new AmericanEnglish().getShortNameWithCountryAndVariant());
    assertEquals("de", new German().getShortNameWithCountryAndVariant());
  }
View Full Code Here

  public void testEqualsConsiderVariantIfSpecified() {
    // every language equals itself:
    assertTrue(new German().equalsConsiderVariantsIfSpecified(new German()));
    assertTrue(new GermanyGerman().equalsConsiderVariantsIfSpecified(new GermanyGerman()));
    assertTrue(new English().equalsConsiderVariantsIfSpecified(new English()));
    assertTrue(new AmericanEnglish().equalsConsiderVariantsIfSpecified(new AmericanEnglish()));
    // equal if variant is the same, but only if specified:
    assertTrue(new AmericanEnglish().equalsConsiderVariantsIfSpecified(new English()));
    assertTrue(new English().equalsConsiderVariantsIfSpecified(new AmericanEnglish()));

    assertFalse(new AmericanEnglish().equalsConsiderVariantsIfSpecified(new BritishEnglish()));
    assertFalse(new English().equalsConsiderVariantsIfSpecified(new German()));
  }
View Full Code Here

    conf.saveConfiguration(lang);
  }

  public void testSaveAndLoadConfigurationForManyLanguages() throws Exception {
    final File tempFile = File.createTempFile(ConfigurationTest.class.getSimpleName(), ".cfg");
    createConfiguration(tempFile, new AmericanEnglish());
    try {
      Configuration conf = new Configuration(tempFile.getParentFile(), tempFile.getName(),
              new AmericanEnglish());
      Set<String> disabledRuleIds = conf.getDisabledRuleIds();
      assertTrue(disabledRuleIds.contains("FOO1"));
      assertTrue(disabledRuleIds.contains("Foo2"));
      assertEquals(2, disabledRuleIds.size());
      Set<String> enabledRuleIds = conf.getEnabledRuleIds();
      assertTrue(enabledRuleIds.contains("enabledRule"));
      assertEquals(1, enabledRuleIds.size());

      //now change language

      conf = new Configuration(tempFile.getParentFile(), tempFile.getName(),
              new Belarusian());
      disabledRuleIds = conf.getDisabledRuleIds();
      assertTrue(disabledRuleIds.isEmpty());
      enabledRuleIds = conf.getEnabledRuleIds();
      assertTrue(enabledRuleIds.isEmpty());

      conf.setEnabledRuleIds(new HashSet<>(Arrays.asList("enabledBYRule")));
      conf.saveConfiguration(new Belarusian());

      //and back...
      conf = new Configuration(tempFile.getParentFile(), tempFile.getName(),
              new AmericanEnglish());
      disabledRuleIds = conf.getDisabledRuleIds();
      assertTrue(disabledRuleIds.contains("FOO1"));
      assertTrue(disabledRuleIds.contains("Foo2"));
      assertEquals(2, disabledRuleIds.size());
      enabledRuleIds = conf.getEnabledRuleIds();
View Full Code Here

    tool.disableCategory("Possible Typo");
    assertEquals(0, tool.check("I've go to go.").size());
  }

  public void testPositionsWithEnglish() throws IOException {
    final JLanguageTool tool = new JLanguageTool(new AmericanEnglish());
    final List<RuleMatch> matches = tool.check("A sentence with no period\n" +
        "A sentence. A typoh.");
    assertEquals(1, matches.size());
    final RuleMatch match = matches.get(0);
    assertEquals(1, match.getLine());
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.