当前位置: 首页>>代码示例>>Java>>正文


Java JLanguageTool.activateDefaultPatternRules方法代码示例

本文整理汇总了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.");
}
 
开发者ID:kennanmeyer,项目名称:SE-410-Project,代码行数:20,代码来源:TestLangTool.java

示例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);
}
 
开发者ID:markkohdev,项目名称:oStorybook,代码行数:12,代码来源:ConfigurationDialog.java

示例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();
	}
}
 
开发者ID:intersystems-ru,项目名称:languagemodel-slavic,代码行数:15,代码来源:LanguageToolAnalyzer.java


注:本文中的org.languagetool.JLanguageTool.activateDefaultPatternRules方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。