Examples of activateDefaultPatternRules()


Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

  public void testCompleteText2() throws Exception {
    InputStream stream = SuggestionReplacerTest.class.getResourceAsStream("/org/languagetool/dev/wikipedia/wikipedia2.txt");
    String origMarkup = IOUtils.toString(stream, "utf-8");
    JLanguageTool langTool = new JLanguageTool(germanyGerman);
    langTool.activateDefaultPatternRules();
    PlainTextMapping mapping = filter.filter(origMarkup);
    List<RuleMatch> matches = langTool.check(mapping.getPlainText());
    assertTrue("Expected >= 30 matches, got: " + matches, matches.size() >= 30);
    for (RuleMatch match : matches) {
      SuggestionReplacer replacer = new SuggestionReplacer(mapping, origMarkup, new ErrorMarker("<s>", "</s>"));
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

  }

  private JLanguageTool getLanguageTool(Language language) {
    try {
      JLanguageTool langTool = new JLanguageTool(language);
      langTool.activateDefaultPatternRules();
      return langTool;
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

    //final Language language = new French();
    //final Language language = new Spanish();
    //final Language language = new Polish();
    //final Language language = new German();
    final JLanguageTool lt = new JLanguageTool(language);
    lt.activateDefaultPatternRules();

    System.out.println("Creating index for " + language + "...");
    final int ruleCount = createIndex(lt);
    System.out.println("Index created with " + ruleCount + " rules");
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

  private void run(File propFile, Set<String> disabledRules, String langCode, List<String> fileNames, String[] ruleIds,
                   String[] additionalCategoryIds, int maxSentences, int maxErrors, File languageModelDir) throws IOException {
    final Language lang = Language.getLanguageForShortName(langCode);
    final JLanguageTool languageTool = new MultiThreadedJLanguageTool(lang);
    languageTool.activateDefaultPatternRules();
    if (languageModelDir != null) {
      languageTool.activateLanguageModelRules(languageModelDir);
    }
    if (ruleIds != null) {
      enableOnlySpecifiedRules(ruleIds, languageTool);
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

public class ToolsTest extends TestCase {

  public void testCheck() throws IOException, ParserConfigurationException, SAXException {
    final JLanguageTool tool = new JLanguageTool(new Polish());
    tool.activateDefaultPatternRules();
    tool.activateDefaultFalseFriendRules();

    List<RuleMatch> matches = tool.check("To jest całkowicie prawidłowe zdanie.");
    assertEquals(0, matches.size());
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

    assertEquals("WORD_REPEAT_RULE", matches2.get(0).getRule().getId());
  }

  public void testCorrect() throws IOException, ParserConfigurationException, SAXException {
    JLanguageTool tool = new JLanguageTool(new Polish());
    tool.activateDefaultPatternRules();
    tool.activateDefaultFalseFriendRules();

    String correct = Tools.correctText("To jest całkowicie prawidłowe zdanie.", tool);
    assertEquals("To jest całkowicie prawidłowe zdanie.", correct);
    correct = Tools.correctText("To jest jest problem.", tool);
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

    System.out.printf("Expected errors found: " + errorFoundCount + " (%.2f%%)\n", percentage);
  }

  private List<Rule> getRules(Language lang) throws IOException {
    JLanguageTool langTool = new JLanguageTool(lang);
    langTool.activateDefaultPatternRules();
    return langTool.getAllActiveRules();
  }

  private boolean queryAtDServer(IncorrectExample example) {
    String sentence = removeMarker(example.getExample());
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

 
  private static final int BATCH_SIZE = 1000;

  private void run(Language language, File file) throws IOException {
    JLanguageTool lt = new JLanguageTool(language);
    lt.activateDefaultPatternRules();
    Scanner scanner = new Scanner(file);
    int count = 0;
    long startTime = System.currentTimeMillis();
    while (scanner.hasNextLine()) {
      String line = scanner.nextLine();
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

  }

  // used to cause an ArrayIndexOutOfBoundsException in MatchState.setToken()
  public void testBug() throws Exception {
    JLanguageTool langTool = new JLanguageTool(new English());
    langTool.activateDefaultPatternRules();
    langTool.check("Alexander between 369 and 358 BC\n\nAlexander");
  }

}
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

public class ToolsTest extends TestCase {

  public void testCorrect() throws IOException, ParserConfigurationException, SAXException {
    final JLanguageTool tool = new JLanguageTool(new English());
    tool.activateDefaultPatternRules();
    tool.activateDefaultFalseFriendRules();
    assertEquals("This is a test.", Tools.correctText("This is an test.", tool));
  }
 
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.