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


Java JLanguageTool.getMessageBundle方法代码示例

本文整理汇总了Java中org.languagetool.JLanguageTool.getMessageBundle方法的典型用法代码示例。如果您正苦于以下问题:Java JLanguageTool.getMessageBundle方法的具体用法?Java JLanguageTool.getMessageBundle怎么用?Java JLanguageTool.getMessageBundle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.languagetool.JLanguageTool的用法示例。


在下文中一共展示了JLanguageTool.getMessageBundle方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LanguageToolEvaluator

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
LanguageToolEvaluator(File indexTopDir) throws IOException {
  langTool = new JLanguageTool(new BritishEnglish());
  disableRules();
  if (indexTopDir != null) {
    if (indexTopDir.isDirectory()) {
      languageModel = new LuceneLanguageModel(indexTopDir);
      System.out.println("Using Lucene language model from " + languageModel);
      EnglishConfusionProbabilityRule probabilityRule =
              new EnglishConfusionProbabilityRule(JLanguageTool.getMessageBundle(), languageModel, new English());
      //new EnglishConfusionProbabilityRule(JLanguageTool.getMessageBundle(), languageModel, new File("/tmp/languagetool_network.net"));
      langTool.addRule(probabilityRule);
    } else {
      throw new RuntimeException("Does not exist or not a directory: " + indexTopDir);
    }
  } else {
    languageModel = null;
  }
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:19,代码来源:LanguageToolEvaluator.java

示例2: HTTPServer

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
/**
 * Prepare a server on the given host and port - use run() to start it.
 * @param runInternally if true, then the server was started from the GUI.
 * @param host the host to bind to, e.g. <code>"localhost"</code> or <code>null</code> to bind to any host
 * @param allowedIps the IP addresses from which connections are allowed or <code>null</code> to allow any host
 * @throws PortBindingException if we cannot bind to the given port, e.g. because something else is running there
 * @since 1.7
 */
public HTTPServer(HTTPServerConfig config, boolean runInternally, String host, Set<String> allowedIps) {
  this.port = config.getPort();
  this.host = host;
  try {
    InetSocketAddress address = host != null ? new InetSocketAddress(host, port) : new InetSocketAddress(port);
    server = HttpServer.create(address, 0);
    RequestLimiter limiter = getRequestLimiterOrNull(config);
    ErrorRequestLimiter errorLimiter = getErrorRequestLimiterOrNull(config);
    LinkedBlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<>();
    httpHandler = new LanguageToolHttpHandler(config, allowedIps, runInternally, limiter, errorLimiter, workQueue);
    server.createContext("/", httpHandler);
    executorService = getExecutorService(workQueue, config);
    server.setExecutor(executorService);
    if (config.getWarmUp()) {
      warmUp();
    }
  } catch (Exception e) {
    ResourceBundle messages = JLanguageTool.getMessageBundle();
    String message = Tools.i18n(messages, "http_server_start_failed", host, Integer.toString(port));
    throw new PortBindingException(message, e);
  }
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:31,代码来源:HTTPServer.java

示例3: LangToolMain

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
public LangToolMain(JFrame parent) throws IOException {
	LanguageIdentifierTools.addLtProfiles();
	config = new Configuration(new File(System.getProperty("user.home")),
			CONFIG_FILE);
	messages = JLanguageTool.getMessageBundle();
	maybeStartServer();
	this.parent = parent;
}
 
开发者ID:markkohdev,项目名称:oStorybook,代码行数:9,代码来源:LangToolMain.java

示例4: LanguageManagerDialog

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
public LanguageManagerDialog(Frame owner, List<Language> languages) {
  this.owner = owner;
  for (Language lang : languages) {
    for (String ruleFile : lang.getRuleFileNames()) {
      ruleFiles.add(new File(ruleFile));
    }
  }
  messages = JLanguageTool.getMessageBundle();
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:10,代码来源:LanguageManagerDialog.java

示例5: LanguageToolSupport

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
/**
 * LanguageTool support for a JTextComponent
 * @since 2.7
 */
LanguageToolSupport(JFrame frame, JTextComponent textComponent, UndoRedoSupport support) {
  this.frame = frame;
  this.textComponent = textComponent;
  this.messages = JLanguageTool.getMessageBundle();
  ruleMatches = new ArrayList<>();
  documentSpans = new ArrayList<>();    
  this.undo = support;
  this.langIdentifier = new LanguageIdentifier();
  init();
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:15,代码来源:LanguageToolSupport.java

示例6: test

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
@Test
public void test() throws IOException {
  Language german = Languages.getLanguageForShortCode("de");
  OldSpellingRule rule = new OldSpellingRule(JLanguageTool.getMessageBundle());
  JLanguageTool lt = new JLanguageTool(german);

  AnalyzedSentence sentence1 = lt.getAnalyzedSentence("Ein Kuß");
  assertThat(rule.match(sentence1).length, is(1));
  assertThat(rule.match(sentence1)[0].getSuggestedReplacements().toString(), is("[Kuss]"));

  AnalyzedSentence sentence2 = lt.getAnalyzedSentence("Das Corpus delicti");
  assertThat(rule.match(sentence2).length, is(1));
  assertThat(rule.match(sentence2)[0].getSuggestedReplacements().toString(), is("[Corpus Delicti]"));

  // inflected forms should work, too (as long as the inflection database still contains the old variants):
  AnalyzedSentence sentence3 = lt.getAnalyzedSentence("In Rußlands Weiten");
  assertThat(rule.match(sentence3).length, is(1));
  assertThat(rule.match(sentence3)[0].getSuggestedReplacements().toString(), is("[Russlands]"));

  AnalyzedSentence sentence4 = lt.getAnalyzedSentence("Hot pants");
  assertThat(rule.match(sentence4).length, is(1));
  assertThat(rule.match(sentence4)[0].getSuggestedReplacements().toString(), is("[Hotpants]"));

  AnalyzedSentence sentence5 = lt.getAnalyzedSentence("Ich muß los");
  assertThat(rule.match(sentence5).length, is(1));
  assertThat(rule.match(sentence5)[0].getSuggestedReplacements().toString(), is("[muss]"));

  assertThat(rule.match(lt.getAnalyzedSentence("In Russland")).length, is(0));
  assertThat(rule.match(lt.getAnalyzedSentence("In Russlands Weiten")).length, is(0));
  assertThat(rule.match(lt.getAnalyzedSentence("Schlüsse")).length, is(0));
  assertThat(rule.match(lt.getAnalyzedSentence("in Schloß Holte")).length, is(0));
  assertThat(rule.match(lt.getAnalyzedSentence("Asse")).length, is(0));
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:34,代码来源:OldSpellingRuleTest.java

示例7: ConfigurationDialog

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
public ConfigurationDialog(Frame owner, boolean insideOffice, Configuration config) {
  this.owner = owner;
  this.insideOffice = insideOffice;
  this.original = config;
  this.config = original.copy(original);
  messages = JLanguageTool.getMessageBundle();
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:8,代码来源:ConfigurationDialog.java

示例8: RealWordFalseAlarmEvaluator

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
RealWordFalseAlarmEvaluator(File languageModelIndexDir) throws IOException {
  try (InputStream inputStream = JLanguageTool.getDataBroker().getFromResourceDirAsStream("/en/confusion_sets.txt")) {
    ConfusionSetLoader confusionSetLoader = new ConfusionSetLoader();
    confusionSets = confusionSetLoader.loadConfusionSet(inputStream);
  }
  langTool = new JLanguageTool(new BritishEnglish());
  List<Rule> rules = langTool.getAllActiveRules();
  for (Rule rule : rules) {
    langTool.disableRule(rule.getId());
  }
  languageModel = new LuceneLanguageModel(languageModelIndexDir);
  confusionRule = new EnglishConfusionProbabilityRule(JLanguageTool.getMessageBundle(), languageModel, new English());
  langTool.addRule(confusionRule);
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:15,代码来源:RealWordFalseAlarmEvaluator.java

示例9: NgramLanguageToolEvaluator

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
NgramLanguageToolEvaluator(File... indexTopDirs) throws IOException {
  langTool = new JLanguageTool(new English());
  disableAllRules();
  List<LanguageModel> lms = new ArrayList<>();
  for (File indexTopDir : indexTopDirs) {
    lms.add(new LuceneLanguageModel(indexTopDir));
  }
  languageModel = new MultiLanguageModel(lms);
  LuceneSingleIndexLanguageModel.clearCaches();
  System.out.println("Using Lucene language model from " + languageModel);
  probabilityRule = new EnglishNgramProbabilityRule(JLanguageTool.getMessageBundle(), languageModel, new English());
  probabilityRule.setDefaultOn();
  langTool.addRule(probabilityRule);
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:15,代码来源:SimpleCorpusEvaluator.java

示例10: ConfigurationDialog

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
public ConfigurationDialog(Frame owner, boolean insideOOo) {
	this.owner = owner;
	this.insideOOo = insideOOo;
	messages = JLanguageTool.getMessageBundle();
}
 
开发者ID:markkohdev,项目名称:oStorybook,代码行数:6,代码来源:ConfigurationDialog.java

示例11: Main

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
private Main() {
  LanguageIdentifierTools.addLtProfiles();
  messages = JLanguageTool.getMessageBundle();
}
 
开发者ID:thamizha,项目名称:thamizha-ilakkanam,代码行数:5,代码来源:Main.java

示例12: FakeRule

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
private FakeRule(LanguageModel languageModel, Language language) {
  super(JLanguageTool.getMessageBundle(), languageModel, language);
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:4,代码来源:ConfusionProbabilityRuleTest.java

示例13: Main

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
private Main(LocalStorage localStorage) {
  this.localStorage = localStorage;
  messages = JLanguageTool.getMessageBundle();
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:5,代码来源:Main.java

示例14: FontChooser

import org.languagetool.JLanguageTool; //导入方法依赖的package包/类
/**
 * Creates a new font chooser dialog
 *
 * @param owner the {@code Frame} from which the dialog is displayed
 * @param modal specifies whether dialog blocks user input to other top-level
 * windows when shown.
 */
FontChooser(Frame owner, boolean modal) {
  super(owner, modal);
  messages = JLanguageTool.getMessageBundle();
  initComponents();
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:13,代码来源:FontChooser.java


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