use of org.languagetool.language.Spanish in project languagetool by languagetool-org.
the class MorfologikSpanishSpellerRuleTest method testMorfologikSpeller.
@Test
public void testMorfologikSpeller() throws IOException {
Spanish language = new Spanish();
MorfologikSpanishSpellerRule rule = new MorfologikSpanishSpellerRule(TestTools.getMessages("en"), language);
JLanguageTool langTool = new JLanguageTool(language);
assertEquals(0, rule.match(langTool.getAnalyzedSentence("Escriba un texto aquí. LanguageTool le ayudará a afrontar algunas dificultades propias de la escritura.")).length);
RuleMatch[] matches = rule.match(langTool.getAnalyzedSentence("Se a hecho un esfuerzo para detectar errores tipográficos, ortograficos y incluso gramaticales."));
assertEquals(1, matches.length);
assertEquals(59, matches[0].getFromPos());
assertEquals(71, matches[0].getToPos());
assertEquals("ortográficos", matches[0].getSuggestedReplacements().get(0));
}
use of org.languagetool.language.Spanish in project languagetool by languagetool-org.
the class GenericUnpairedBracketsRuleTest method testSpanishRule.
@Test
public void testSpanishRule() throws IOException {
langTool = new JLanguageTool(new Spanish());
rule = org.languagetool.rules.GenericUnpairedBracketsRuleTest.getBracketsRule(langTool);
// correct sentences:
assertMatches("Soy un hombre (muy honrado).", 0);
// incorrect sentences:
assertMatches("De dónde vas?", 1);
assertMatches("¡Atención", 1);
}
Aggregations