本文整理汇总了Java中org.languagetool.Language.ENGLISH属性的典型用法代码示例。如果您正苦于以下问题:Java Language.ENGLISH属性的具体用法?Java Language.ENGLISH怎么用?Java Language.ENGLISH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.languagetool.Language
的用法示例。
在下文中一共展示了Language.ENGLISH属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
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: getCurrentLanguage
private Language getCurrentLanguage() {
if (autoDetectBox.isSelected()) {
final LanguageIdentifier langIdentifier = new LanguageIdentifier(
textArea.getText());
Language lang = Language.getLanguageForShortName(langIdentifier
.getLanguage());
if (lang == null) {
lang = Language.ENGLISH;
}
for (int i = 0; i < languageBox.getItemCount(); i++) {
final I18nLanguage boxLanguage = (I18nLanguage) languageBox
.getItemAt(i);
if (boxLanguage.toString().equals(
lang.getTranslatedName(messages))) {
languageBox.setSelectedIndex(i);
}
}
return lang;
} else {
return ((I18nLanguage) languageBox.getSelectedItem()).getLanguage();
}
}
示例3: main
/**
* 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);
}