Search in sources :

Example 1 with Tagger

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

the class GermanTaggerEnhancer method run.

private void run() throws IOException {
    final Dictionary dictionary = Dictionary.read(JLanguageTool.getDataBroker().getFromResourceDirAsUrl("/de/german.dict"));
    final DictionaryLookup dl = new DictionaryLookup(dictionary);
    Tagger tagger = new German().getTagger();
    String prev = null;
    for (WordData wd : dl) {
        String word = wd.getWord().toString();
        if (word.endsWith("er") && StringTools.startsWithUppercase(word)) {
            if (!hasAdjReading(tagger, word) && isEigenname(tagger, word.substring(0, word.length() - 2)) && !word.equals(prev)) {
                for (String newTags : ADJ_READINGS) {
                    System.out.println(word + "\t" + word + "\t" + newTags + ":DEF");
                    System.out.println(word + "\t" + word + "\t" + newTags + ":IND");
                    System.out.println(word + "\t" + word + "\t" + newTags + ":SOL");
                }
                prev = word;
            }
        }
    }
}
Also used : Dictionary(morfologik.stemming.Dictionary) Tagger(org.languagetool.tagging.Tagger) WordData(morfologik.stemming.WordData) German(org.languagetool.language.German) DictionaryLookup(morfologik.stemming.DictionaryLookup)

Aggregations

Dictionary (morfologik.stemming.Dictionary)1 DictionaryLookup (morfologik.stemming.DictionaryLookup)1 WordData (morfologik.stemming.WordData)1 German (org.languagetool.language.German)1 Tagger (org.languagetool.tagging.Tagger)1