私はEclipseと一緒にLanguageToolを使用しています。 APIは、Click hereのリンクを使用してアクセスできます。私は、特定の列にスペルミスがあることを示すテキスト出力を得ることができますが、入力として与えられたスペルミスの修正された文字列バージョンである出力を得ることができません。ここに私のコードは次のとおりです。LanguageToolの出力として文字列にSuggested Sentenceを出力するにはどうすればよいですか?
JLanguageTool langTool = new JLanguageTool(new BritishEnglish());
List<RuleMatch> matches = langTool.check("A sentence with a error in the Hitchhiker's Guide tot he Galaxy");
for (RuleMatch match : matches) {
System.out.println("Potential error at line " +
match.getLine() + ", column " +
match.getColumn() + ": " + match.getMessage());
System.out.println("Suggested correction: " +
match.getSuggestedReplacements());
}
得られる出力は次のとおりです。
私はどのようにA sentence with an error in the Hitchhiker's Guide to the Galaxy
:
Potential error at line 0, column 17: Use <suggestion>an</suggestion> instead of 'a' if the following word starts with a vowel sound, e.g. 'an article', 'an hour'
Suggested correction: [an]
Potential error at line 0, column 32: Possible spelling mistake found
Suggested correction: [Hitch-hiker]
Potential error at line 0, column 51: Did you mean <suggestion>to the</suggestion>?
Suggested correction: [to the]
私のように、出力は入力文字列の修正バージョンになりたいですこれを行う?
ありがとうございます。 – Ravichandra