本文整理汇总了Java中org.languagetool.JLanguageTool.activateDefaultPatternRules方法的典型用法代码示例。如果您正苦于以下问题:Java JLanguageTool.activateDefaultPatternRules方法的具体用法?Java JLanguageTool.activateDefaultPatternRules怎么用?Java JLanguageTool.activateDefaultPatternRules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.languagetool.JLanguageTool
的用法示例。
在下文中一共展示了JLanguageTool.activateDefaultPatternRules方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
public static void main(String[] args) {
System.out.println("start...");
try {
JLanguageTool langTool = new JLanguageTool(Language.ENGLISH);
langTool.activateDefaultPatternRules();
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.getEndLine() + ", column " + match.getColumn()
+ ": " + match.getMessage());
System.out.println("Suggested correction: "
+ match.getSuggestedReplacements());
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("finished.");
}
示例2: main
import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
/**
* Opens the dialog - for internal testing only.
*/
public static void main(String[] args) throws IOException {
final ConfigurationDialog dlg = new ConfigurationDialog(null, false);
final List<Rule> rules = new ArrayList<Rule>();
final JLanguageTool lt = new JLanguageTool(Language.ENGLISH);
lt.activateDefaultPatternRules();
rules.addAll(lt.getAllRules());
dlg.show(rules);
}
示例3: LanguageToolAnalyzer
import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
/**
* @throws IOException
* @throws ParserConfigurationException
* @throws SAXException
*/
public LanguageToolAnalyzer() throws IOException, ParserConfigurationException, SAXException {
this.analyzers.put("ru", Engine.create(new JLanguageTool(new Russian()), new RussianTagParser(), RUSSIAN_WORD_FILTER));
this.analyzers.put("uk", Engine.create(new JLanguageTool(new Ukrainian()), new UkrainianTagParser()));
for (final Engine engine : this.analyzers.values()) {
final JLanguageTool languageTool = engine.languageTool;
languageTool.activateDefaultFalseFriendRules();
languageTool.activateDefaultPatternRules();
}
}