Search in sources :

Example 1 with ManualTagger

use of org.languagetool.tagging.ManualTagger in project languagetool by languagetool-org.

the class MatchTest method setUp.

//-- setup
@Before
public void setUp() throws Exception {
    tagger = new ManualTaggerAdapter(new ManualTagger(new ByteArrayInputStream(TEST_DATA.getBytes("UTF-8"))));
    synthesizer = new ManualSynthesizerAdapter(new ManualSynthesizer(new ByteArrayInputStream(TEST_DATA.getBytes("UTF-8"))));
    languageTool = new JLanguageTool(new Demo() {

        @Override
        public String getName() {
            return "TEST";
        }

        @Override
        public Synthesizer getSynthesizer() {
            return MatchTest.this.synthesizer;
        }

        @Override
        public Tagger getTagger() {
            return MatchTest.this.tagger;
        }
    });
}
Also used : Demo(org.languagetool.language.Demo) ManualTaggerAdapter(org.languagetool.tokenizers.ManualTaggerAdapter) ByteArrayInputStream(java.io.ByteArrayInputStream) JLanguageTool(org.languagetool.JLanguageTool) ManualSynthesizerAdapter(org.languagetool.synthesis.ManualSynthesizerAdapter) ManualTagger(org.languagetool.tagging.ManualTagger) ManualSynthesizer(org.languagetool.synthesis.ManualSynthesizer) Before(org.junit.Before)

Example 2 with ManualTagger

use of org.languagetool.tagging.ManualTagger in project languagetool by languagetool-org.

the class EsperantoTagger method lazyInit.

private void lazyInit() throws IOException {
    if (manualTagger != null) {
        return;
    }
    // strict rules for their suffixes.
    try (InputStream stream = JLanguageTool.getDataBroker().getFromResourceDirAsStream("/eo/manual-tagger.txt")) {
        manualTagger = new ManualTagger(stream);
    }
    // Load set of transitive and intransitive verbs.  Files don't contain
    // verbs with suffix -iĝ or -ig since transitivity is obvious for those verbs.
    // They also don't contain verbs with prefixes mal-, ek-, re-, mis- fi- and
    // suffixes -ad, -aĉ, -et, -eg since these affixes never alter transitivity.
    setTransitiveVerbs = loadWords(JLanguageTool.getDataBroker().getFromRulesDirAsStream("/eo/verb-tr.txt"));
    setIntransitiveVerbs = loadWords(JLanguageTool.getDataBroker().getFromRulesDirAsStream("/eo/verb-ntr.txt"));
    setNonParticiple = loadWords(JLanguageTool.getDataBroker().getFromRulesDirAsStream("/eo/root-ant-at.txt"));
}
Also used : InputStream(java.io.InputStream) ManualTagger(org.languagetool.tagging.ManualTagger)

Aggregations

ManualTagger (org.languagetool.tagging.ManualTagger)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 Before (org.junit.Before)1 JLanguageTool (org.languagetool.JLanguageTool)1 Demo (org.languagetool.language.Demo)1 ManualSynthesizer (org.languagetool.synthesis.ManualSynthesizer)1 ManualSynthesizerAdapter (org.languagetool.synthesis.ManualSynthesizerAdapter)1 ManualTaggerAdapter (org.languagetool.tokenizers.ManualTaggerAdapter)1