Hello,
I have written a small sample code to auto-correct a string:
import java.util.List;
import org.languagetool.tools.Tools;
import org.languagetool.JLanguageTool;
import org.languagetool.language.GermanyGerman;
import org.languagetool.language.BritishEnglish;
import org.languagetool.rules.*;
public class Rechtschreibung {
public static void main(String[] args){
String text = "Fußball";
try {
JLanguageTool lt = new JLanguageTool(new GermanyGerman());
System.out.println(Tools.correctText(text, lt));
} catch (Exception e) {
e.printStackTrace();
}
}
}
I’m using Gradle in combination with the maven repository ‘org.languagetool:language-de:2.9’ and ‘org.languagetool:language-en:2.9’.
When running the code, languagetool changes “Fußball” to “Funkball”, while LanguageTool - Grammatik-, Stil- und Rechtschreibprüfung correctly finds no mistake. When using “Fertigstelln” the first suggestion of the web interface is “Fertigstellen” while my code simply returns “Fertigstelln”. It is my understanding that Tools.correctText() should apply the first match.
i checked getDisabledRules() and received an empty set, so all standard rules are being applied. Is the web interface using custom rules/dictionaries? How should I change the code to improve results?
Thanks in advance,
Julian