Examples of activateDefaultFalseFriendRules()


Examples of org.languagetool.JLanguageTool.activateDefaultFalseFriendRules()

  @Override
  public void run() {   
    try {
      final JLanguageTool langTool = new JLanguageTool(docLanguage, cfgDialog.getMotherTongue());
      langTool.activateDefaultPatternRules();
      langTool.activateDefaultFalseFriendRules();
      cfgDialog.show(langTool.getAllRules());
      config.setDisabledRuleIds(cfgDialog.getDisabledRuleIds());
      config.setEnabledRuleIds(cfgDialog.getEnabledRuleIds());
      config.setDisabledCategoryNames(cfgDialog.getDisabledCategoryNames());
      config.setMotherTongue(cfgDialog.getMotherTongue());
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultFalseFriendRules()

   * @throws Exception when JLanguageTool creation failed
   */
  private JLanguageTool getLanguageToolInstance(Language lang, Language motherTongue) throws Exception {
    final JLanguageTool newLanguageTool = new JLanguageTool(lang, motherTongue);
    newLanguageTool.activateDefaultPatternRules();
    newLanguageTool.activateDefaultFalseFriendRules();
    config = new Configuration(lang);
    if (!useQuerySettings && internalServer && config.getUseGUIConfig()) { // use the GUI config values
      configureGUI(newLanguageTool);
    }
    if (useQuerySettings) {
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultFalseFriendRules()

  }

  public void testCheck() throws IOException, ParserConfigurationException, SAXException {
    final JLanguageTool tool = new JLanguageTool(Language.DEMO);
    tool.activateDefaultPatternRules();
    tool.activateDefaultFalseFriendRules();
    int matches = Tools.checkText("Foo.", tool);
    String output = new String(this.out.toByteArray());
    assertEquals(0, output.indexOf("Time:"));
    assertEquals(0, matches);
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultFalseFriendRules()

  }

  public void testCheck() throws IOException, ParserConfigurationException, SAXException {
    final JLanguageTool tool = new JLanguageTool(new Polish());
    tool.activateDefaultPatternRules();
    tool.activateDefaultFalseFriendRules();
    int matches = Tools.checkText("To jest całkowicie prawidłowe zdanie.", tool);
    String output = new String(this.out.toByteArray());
    assertEquals(0, output.indexOf("Time:"));
    assertEquals(0, matches);
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultFalseFriendRules()

  }

  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);
    assertEquals("To jest problem.", correct);
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultFalseFriendRules()

   * @param motherTongue the user's mother tongue or {@code null}
   */
  private JLanguageTool getLanguageToolInstance(Language lang, Language motherTongue, QueryParams params) throws Exception {
    final JLanguageTool newLanguageTool = new JLanguageTool(lang, motherTongue);
    newLanguageTool.activateDefaultPatternRules();
    newLanguageTool.activateDefaultFalseFriendRules();
    if (languageModelDir != null) {
      newLanguageTool.activateLanguageModelRules(languageModelDir);
    }
    final Configuration config = new Configuration(lang);
    if (!params.useQuerySettings && internalServer && config.getUseGUIConfig()) { // use the GUI config values
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultFalseFriendRules()

  @Override
  public void run() {
    try {
      final JLanguageTool langTool = new JLanguageTool(docLanguage, config.getMotherTongue());
      langTool.activateDefaultPatternRules();
      langTool.activateDefaultFalseFriendRules();
      cfgDialog.show(langTool.getAllRules());
      config.saveConfiguration(docLanguage);
      if (mainThread != null) {
        mainThread.resetDocument();
      }
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultFalseFriendRules()

public class FalseFriendRuleTest extends TestCase {

  public void testHintsForGermanSpeakers() throws IOException, ParserConfigurationException, SAXException {
    final JLanguageTool langTool = new JLanguageTool(new English(), new German());
    langTool.activateDefaultFalseFriendRules();
    final List<RuleMatch> matches = assertErrors(1, "We will berate you.", langTool);
    assertEquals(matches.get(0).getSuggestedReplacements().toString(), "[to provide advice, to give advice]");
    assertErrors(0, "We will give you advice.", langTool);
    assertErrors(1, "I go to high school in Foocity.", langTool);
    final List<RuleMatch> matches2 = assertErrors(1, "The chef", langTool);
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultFalseFriendRules()

    assertEquals("[boss, chief]", matches2.get(0).getSuggestedReplacements().toString());
  }

  public void testHintsForGermanSpeakersWithVariant() throws IOException, ParserConfigurationException, SAXException {
    final JLanguageTool langTool = new JLanguageTool(new BritishEnglish(), new SwissGerman());
    langTool.activateDefaultFalseFriendRules();
    final List<RuleMatch> matches = assertErrors(1, "We will berate you.", langTool);
    assertEquals(matches.get(0).getSuggestedReplacements().toString(), "[to provide advice, to give advice]");
    assertErrors(0, "We will give you advice.", langTool);
    assertErrors(1, "I go to high school in Berlin.", langTool);
    final List<RuleMatch> matches2 = assertErrors(1, "The chef", langTool);
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultFalseFriendRules()

  }

  public void testHintsForDemoLanguage() throws IOException, ParserConfigurationException, SAXException {
    final JLanguageTool langTool1 = new JLanguageTool(new BritishEnglish(), new German());
    langTool1.disableRule(MorfologikBritishSpellerRule.RULE_ID);
    langTool1.activateDefaultFalseFriendRules();
    final List<RuleMatch> matches1 = assertErrors(1, "And forDemoOnly.", langTool1);
    assertEquals("DEMO_ENTRY", matches1.get(0).getRule().getId());

    final JLanguageTool langTool2 = new JLanguageTool(new English(), new German());
    langTool2.disableRule(MorfologikBritishSpellerRule.RULE_ID);
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.