use of org.languagetool.language.English in project languagetool by languagetool-org.
the class UppercaseSentenceStartRuleTest method testRule.
@Test
public void testRule() throws IOException {
JLanguageTool lt = new JLanguageTool(new English());
assertEquals(0, lt.check("In Nov. next year.").size());
assertEquals(0, lt.check("www.languagetool.org is a website.").size());
assertEquals(0, lt.check("Languagetool.org is a website.").size());
assertEquals(1, lt.check("languagetool.org is a website.").size());
assertEquals(1, lt.check("a sentence.").size());
assertEquals(1, lt.check("a sentence!").size());
}
use of org.languagetool.language.English in project languagetool by languagetool-org.
the class EnglishDisambiguationRuleTest method setUp.
@Before
public void setUp() {
tagger = new EnglishTagger();
tokenizer = new WordTokenizer();
sentenceTokenizer = new SRXSentenceTokenizer(new English());
disambiguator = new XmlRuleDisambiguator(new English());
disamb2 = new DemoDisambiguator();
}
use of org.languagetool.language.English in project languagetool by languagetool-org.
the class EnglishChunkerTest method testContractions.
@Test
public void testContractions() throws Exception {
JLanguageTool langTool = new JLanguageTool(new English());
AnalyzedSentence analyzedSentence = langTool.getAnalyzedSentence("I'll be there");
AnalyzedTokenReadings[] tokens = analyzedSentence.getTokens();
assertThat(tokens[1].getChunkTags().get(0), is(new ChunkTag("B-NP-singular")));
// "'" cannot be mapped as we tokenize differently
assertThat(tokens[2].getChunkTags().size(), is(0));
// "ll" cannot be mapped as we tokenize differently
assertThat(tokens[3].getChunkTags().size(), is(0));
assertThat(tokens[5].getChunkTags().get(0), is(new ChunkTag("I-VP")));
}
use of org.languagetool.language.English in project languagetool by languagetool-org.
the class EnglishChunkerTest method testAddChunkTagsSingular.
@Test
public void testAddChunkTagsSingular() throws Exception {
EnglishChunker chunker = new EnglishChunker();
JLanguageTool lt = new JLanguageTool(new English());
List<AnalyzedSentence> sentences = lt.analyzeText("The abacus shows how numbers can be stored");
List<AnalyzedTokenReadings> readingsList = Arrays.asList(sentences.get(0).getTokens());
chunker.addChunkTags(readingsList);
// "The abacus":
assertThat(readingsList.get(1).getChunkTags().toString(), is("[B-NP-singular]"));
assertThat(readingsList.get(3).getChunkTags().toString(), is("[E-NP-singular]"));
// "numbers":
assertThat(readingsList.get(9).getChunkTags().toString(), is("[B-NP-plural, E-NP-plural]"));
}
use of org.languagetool.language.English in project languagetool by languagetool-org.
the class AvsAnRuleTest method setUp.
@Before
public void setUp() throws IOException {
rule = new AvsAnRule(TestTools.getEnglishMessages());
langTool = new JLanguageTool(new English());
}
Aggregations