Back to LanguageTool Homepage - Privacy - Imprint

How to lemmatize?


(simosimo) #1

Hi, is there a way to perform lemmatization with LT?
I know i can POS Tag, but then how can i retrieve the correspondant Lemma for the single POS?
In particular, i need italian lemmatization and i know that the italian.dict in resources is FSA automata right for the job.
Thanks in advance.
Simone


(Daniel Naber) #2

You can use the analyzeText() method:

    JLanguageTool lt = new JLanguageTool(new Italian());

    List<AnalyzedSentence> analyzedSentences = lt.analyzeText("Linux รจ una famiglia di sistemi operativi di tipo Unix-like");
    for (AnalyzedSentence analyzedSentence : analyzedSentences) {
      for (AnalyzedTokenReadings analyzedTokens : analyzedSentence.getTokensWithoutWhitespace()) {
        if (analyzedTokens.getReadings().size() > 0) {
          System.out.println(analyzedTokens.getReadings().get(0).getLemma());
        }
      }
    }