use of org.languagetool.language.English in project languagetool by languagetool-org.
the class AvsAnRuleTest method testPositions.
@Test
public void testPositions() throws IOException {
RuleMatch[] matches;
JLanguageTool langTool = new JLanguageTool(new English());
// no quotes etc.:
matches = rule.match(langTool.getAnalyzedSentence("a industry standard."));
assertEquals(0, matches[0].getFromPos());
assertEquals(1, matches[0].getToPos());
// quotes..
matches = rule.match(langTool.getAnalyzedSentence("a \"industry standard\"."));
assertEquals(0, matches[0].getFromPos());
assertEquals(1, matches[0].getToPos());
matches = rule.match(langTool.getAnalyzedSentence("a - industry standard\"."));
assertEquals(0, matches[0].getFromPos());
assertEquals(1, matches[0].getToPos());
matches = rule.match(langTool.getAnalyzedSentence("This is a \"industry standard\"."));
assertEquals(8, matches[0].getFromPos());
assertEquals(9, matches[0].getToPos());
matches = rule.match(langTool.getAnalyzedSentence("\"a industry standard\"."));
assertEquals(1, matches[0].getFromPos());
assertEquals(2, matches[0].getToPos());
matches = rule.match(langTool.getAnalyzedSentence("\"Many say this is a industry standard\"."));
assertEquals(18, matches[0].getFromPos());
assertEquals(19, matches[0].getToPos());
matches = rule.match(langTool.getAnalyzedSentence("Like many \"an desperado\" before him, Bart headed south into Mexico."));
assertEquals(11, matches[0].getFromPos());
assertEquals(13, matches[0].getToPos());
}
use of org.languagetool.language.English in project languagetool by languagetool-org.
the class ContractionSpellingRuleTest method setUp.
@Before
public void setUp() throws Exception {
rule = new ContractionSpellingRule(TestTools.getMessages("en"));
langTool = new JLanguageTool(new English());
}
use of org.languagetool.language.English in project languagetool by languagetool-org.
the class EnglishPatternRuleTest method testBug.
// used to cause an ArrayIndexOutOfBoundsException in MatchState.setToken()
@Test
public void testBug() throws Exception {
JLanguageTool langTool = new JLanguageTool(new English());
langTool.check("Alexander between 369 and 358 BC\n\nAlexander");
}
use of org.languagetool.language.English in project languagetool by languagetool-org.
the class EnglishUnpairedBracketsRuleTest method setUp.
@Before
public void setUp() throws IOException {
rule = new EnglishUnpairedBracketsRule(TestTools.getEnglishMessages(), new English());
langTool = new JLanguageTool(new English());
}
use of org.languagetool.language.English in project languagetool by languagetool-org.
the class EnglishUnpairedBracketsRuleTest method testMultipleSentences.
@Test
public void testMultipleSentences() throws IOException {
JLanguageTool lt = new JLanguageTool(new English());
assertEquals(0, getMatches("This is multiple sentence text that contains a bracket: " + "[This is bracket. With some text.] and this continues.\n", lt));
assertEquals(0, getMatches("This is multiple sentence text that contains a bracket. " + "(This is bracket. \n\n With some text.) and this continues.", lt));
assertEquals(1, getMatches("This is multiple sentence text that contains a bracket: " + "[This is bracket. With some text. And this continues.\n\n", lt));
}
Aggregations