Package org.languagetool

Examples of org.languagetool.FakeLanguage


 
  public void testRule() throws IOException {
    final DifferentLengthRule rule = new DifferentLengthRule();
    RuleMatch[] matches;
    final JLanguageTool trgLangTool = new JLanguageTool(TestTools.getDemoLanguage());
    final JLanguageTool srcLangTool = new JLanguageTool(new FakeLanguage());
    rule.setSourceLang(TestTools.getDemoLanguage());
    // correct sentences:
    matches = rule.match(
        srcLangTool.getAnalyzedSentence("This is a test sentence."),
        trgLangTool.getAnalyzedSentence("To zdanie testowe."));
View Full Code Here


 
  public void testRule() throws IOException {
    final SameTranslationRule rule = new SameTranslationRule();
    RuleMatch[] matches;
    final JLanguageTool srcLangTool = new JLanguageTool(TestTools.getDemoLanguage());
    final JLanguageTool trgLangTool = new JLanguageTool(new FakeLanguage());
    rule.setSourceLang(TestTools.getDemoLanguage());
    // correct sentences:
    matches = rule.match(
        srcLangTool.getAnalyzedSentence("This is a test sentence."),
        trgLangTool.getAnalyzedSentence("C'est la vie !"));
View Full Code Here

  @Test
  public void testLanguageAttributes() throws IOException {
    final String xml1 = SERIALIZER.ruleMatchesToXml(Collections.<RuleMatch>emptyList(), "Fake", 5, language);
    assertTrue(xml1.contains("shortname=\"xx-XX\""));
    assertTrue(xml1.contains("name=\"Testlanguage\""));
    final String xml2 = SERIALIZER.ruleMatchesToXml(Collections.<RuleMatch>emptyList(), "Fake", 5, language, new FakeLanguage());
    assertTrue(xml2.contains("shortname=\"xx-XX\""));
    assertTrue(xml2.contains("name=\"Testlanguage\""));
    assertTrue(xml2.contains("shortname=\"yy\""));
    assertTrue(xml2.contains("name=\"FakeLanguage\""));
  }
View Full Code Here

    Language demoLanguage = TestTools.getDemoLanguage();
    assertEquals(" ", StringTools.addSpace("word", demoLanguage));
    assertEquals("", StringTools.addSpace(",", demoLanguage));
    assertEquals("", StringTools.addSpace(",", demoLanguage));
    assertEquals("", StringTools.addSpace(",", demoLanguage));
    assertEquals("", StringTools.addSpace(".", new FakeLanguage("fr")));
    assertEquals("", StringTools.addSpace(".", new FakeLanguage("de")));
    assertEquals(" ", StringTools.addSpace("!", new FakeLanguage("fr")));
    assertEquals("", StringTools.addSpace("!", new FakeLanguage("de")));
  }
View Full Code Here

    writer.addDocument(doc);
  }

  private void testIndex(File languageModelIndex) throws IOException {
    LanguageModel languageModel = new LuceneLanguageModel(languageModelIndex);
    ConfusionProbabilityRule rule = new ConfusionProbabilityRule(TestTools.getEnglishMessages(), languageModel, new FakeLanguage()) {
      @Override public String getDescription() { return null; }
      @Override public String getMessage(String suggestion) { return null; }
    };
    ConfusionProbabilityRule.ConfusionSet confusionSet = new ConfusionProbabilityRule.ConfusionSet("a", "an");
    AnalyzedTokenReadings[] tokens = {
View Full Code Here

TOP

Related Classes of org.languagetool.FakeLanguage

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.