use of org.languagetool.markup.AnnotatedTextBuilder in project languagetool by languagetool-org.
the class JLanguageToolTest method testAnnotateTextCheck.
@Test
public void testAnnotateTextCheck() throws IOException {
JLanguageTool languageTool = new JLanguageTool(english);
AnnotatedText annotatedText = new AnnotatedTextBuilder().addMarkup("<b>").addText("here").addMarkup("</b>").addText(" is an error").build();
List<RuleMatch> matches = languageTool.check(annotatedText);
assertThat(matches.size(), is(1));
assertThat(matches.get(0).getFromPos(), is(3));
assertThat(matches.get(0).getToPos(), is(7));
}
use of org.languagetool.markup.AnnotatedTextBuilder in project languagetool by languagetool-org.
the class SimpleCorpus method makeAnnotatedText.
private AnnotatedText makeAnnotatedText(String text) {
AnnotatedTextBuilder builder = new AnnotatedTextBuilder();
builder.addText(text.replace("_", " ").replaceAll("\\s+", " "));
return builder.build();
}
Aggregations