use of org.languagetool.tagging.disambiguation.xx.DemoDisambiguator in project languagetool by languagetool-org.
the class DisambiguationRuleTest method testDisambiguationRulesFromXML.
private void testDisambiguationRulesFromXML(Set<Language> ignoredLanguages) throws IOException, ParserConfigurationException, SAXException {
for (Language lang : Languages.getWithDemoLanguage()) {
if (ignoredLanguages != null && ignoredLanguages.contains(lang)) {
continue;
}
if (lang.isVariant()) {
System.out.println("Skipping variant: " + lang);
continue;
}
System.out.println("Running disambiguation tests for " + lang.getName() + "...");
DisambiguationRuleLoader ruleLoader = new DisambiguationRuleLoader();
JLanguageTool languageTool = new JLanguageTool(lang);
if (!(languageTool.getLanguage().getDisambiguator() instanceof DemoDisambiguator)) {
long startTime = System.currentTimeMillis();
String name = JLanguageTool.getDataBroker().getResourceDir() + "/" + lang.getShortCode() + "/disambiguation.xml";
validateRuleFile(name);
List<DisambiguationPatternRule> rules = ruleLoader.getRules(ruleLoader.getClass().getResourceAsStream(name));
for (DisambiguationPatternRule rule : rules) {
PatternTestTools.warnIfRegexpSyntaxNotKosher(rule.getPatternTokens(), rule.getId(), rule.getSubId(), lang);
}
testDisambiguationRulesFromXML(rules, languageTool, lang);
long endTime = System.currentTimeMillis();
System.out.println(rules.size() + " rules tested (" + (endTime - startTime) + "ms)");
}
}
}
use of org.languagetool.tagging.disambiguation.xx.DemoDisambiguator 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.tagging.disambiguation.xx.DemoDisambiguator in project languagetool by languagetool-org.
the class UkrainianDisambiguationRuleTest method setUp.
@Before
public void setUp() {
tagger = new UkrainianTagger();
tokenizer = new UkrainianWordTokenizer();
sentenceTokenizer = new SRXSentenceTokenizer(new Ukrainian());
disambiguator = new UkrainianHybridDisambiguator();
demoDisambiguator = new DemoDisambiguator();
chunker = new MultiWordChunker("/uk/multiwords.txt", true);
}
use of org.languagetool.tagging.disambiguation.xx.DemoDisambiguator in project languagetool by languagetool-org.
the class FrenchRuleDisambiguatorTest method setUp.
@Before
public void setUp() throws IOException {
tagger = new FrenchTagger();
tokenizer = new WordTokenizer();
French language = new French();
sentenceTokenizer = new SRXSentenceTokenizer(language);
disambiguator = new XmlRuleDisambiguator(language);
disamb2 = new DemoDisambiguator();
}
use of org.languagetool.tagging.disambiguation.xx.DemoDisambiguator in project languagetool by languagetool-org.
the class RomanianRuleDisambiguatorTest method setUp.
@Before
public void setUp() {
tagger = new RomanianTagger();
tokenizer = new RomanianWordTokenizer();
Romanian language = new Romanian();
sentenceTokenizer = new SRXSentenceTokenizer(language);
disambiguator = new XmlRuleDisambiguator(language);
disamb2 = new DemoDisambiguator();
}
Aggregations