Package org.languagetool.language

Examples of org.languagetool.language.English


    if (!"-".equals(filename)) {
      if (autoDetect) {
        Language language = detectLanguageOfFile(filename, encoding);
        if (language == null) {
          System.err.println("Could not detect language well enough, using English");
          language = new English();
        }
        changeLanguage(language, motherTongue, disabledRules, enabledRules);
        System.out.println("Using " + language.getName() + " for file " + filename);
      }
      final File file = new File(filename);
View Full Code Here


          // to detect language from the first input line
          if (lineCount == 1 && autoDetect) {
            Language language = detectLanguageOfString(line);
            if (language == null) {
              System.err.println("Could not detect language well enough, using English");
              language = new English();
            }
            System.out.println("Language used is: " + language.getName());
            language.getSentenceTokenizer().setSingleLineBreaksMarksParagraph(
                    singleLineBreakMarksParagraph);
            changeLanguage(language, motherTongue, disabledRules, enabledRules);
View Full Code Here

    if (options.getLanguage() == null) {
      if (!options.isApiFormat() && !options.isAutoDetect()) {
        System.err.println("No language specified, using English");
      }
      options.setLanguage(new English());
    } else if (!options.isApiFormat() && !options.isApplySuggestions()) {
      System.out.println("Expected text language: " + options.getLanguage().getName());
    }

    options.getLanguage().getSentenceTokenizer().setSingleLineBreaksMarksParagraph(
View Full Code Here

public class CompoundRuleTest extends CompoundRuleTestAbs {

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    langTool = new JLanguageTool(new English());
    rule = new CompoundRule(null);
  }
View Full Code Here

  @Test
  public void testGetMessageBundle() throws Exception {
    final ResourceBundle bundle1 = JLanguageTool.getMessageBundle(new German());
    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

    assertEquals(4, JLanguageTool.countLineBreaks("\nZweite\nDritte\n\n"));
  }

  @Test
  public void testSentenceTokenize() throws IOException {
    JLanguageTool languageTool = new JLanguageTool(new English());
    List<String> sentences = languageTool.sentenceTokenize("This is a sentence! This is another one.");
    assertEquals(2, sentences.size());
    assertEquals("This is a sentence! ", sentences.get(0));
    assertEquals("This is another one.", sentences.get(1));
  }
View Full Code Here

    System.setOut(this.stdout);
    System.setErr(this.stderr);
  }
 
  public void testBitextCheck() throws IOException, ParserConfigurationException, SAXException {
    final English english = new English();
    final JLanguageTool srcTool = new JLanguageTool(english);
    final Polish polish = new Polish();
    final JLanguageTool trgTool = new JLanguageTool(polish);
    trgTool.activateDefaultPatternRules();
   
View Full Code Here

    final CheckBNC prg = new CheckBNC();
    prg.run(new File(args[0]));
  }
 
  private CheckBNC() throws IOException {
    langTool = new JLanguageTool(new English());
    langTool.activateDefaultPatternRules();
    final String[] disRules = new String[] {"UPPERCASE_SENTENCE_START", "COMMA_PARENTHESIS_WHITESPACE",
        "WORD_REPEAT_RULE", "DOUBLE_PUNCTUATION"};
    System.err.println("Note: disabling the following rules:");
    for (String disRule : disRules) {
View Full Code Here

    String markup = "Hier <ref name=\"NPOVxxx\" /> steht der Haus.";
    applySuggestion(langTool, filter, markup, markup.replace("steht der Haus.", "steht <s>der Haus.</s>"));
  }

  public void testErrorAtTextBeginning() throws Exception {
    JLanguageTool langTool = getLanguageTool(new English());
    SwebleWikipediaTextFilter filter = new SwebleWikipediaTextFilter();
    String markup = "A hour ago\n";
    applySuggestion(langTool, filter, markup, markup.replace("A", "<s>An</s>"));
  }
View Full Code Here

    String markup = "A hour ago\n";
    applySuggestion(langTool, filter, markup, markup.replace("A", "<s>An</s>"));
  }

  public void testErrorAtParagraphBeginning() throws Exception {
    JLanguageTool langTool = getLanguageTool(new English());
    SwebleWikipediaTextFilter filter = new SwebleWikipediaTextFilter();
    String markup = "X\n\nA hour ago\n";
    applySuggestion(langTool, filter, markup, markup.replace("A", "<s>An</s>"));
  }
View Full Code Here

TOP

Related Classes of org.languagetool.language.English

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.