Package org.languagetool.languagemodel

Examples of org.languagetool.languagemodel.LuceneLanguageModel$LuceneSearcher


    doc.add(countField);
    writer.addDocument(doc);
  }

  private void testIndex(File languageModelIndex) throws IOException {
    LanguageModel languageModel = new LuceneLanguageModel(languageModelIndex);
    ConfusionProbabilityRule rule = new ConfusionProbabilityRule(TestTools.getEnglishMessages(), languageModel, new FakeLanguage()) {
      @Override public String getDescription() { return null; }
      @Override public String getMessage(String suggestion) { return null; }
    };
    ConfusionProbabilityRule.ConfusionSet confusionSet = new ConfusionProbabilityRule.ConfusionSet("a", "an");
View Full Code Here


  }

  @Override
  public synchronized LanguageModel getLanguageModel(File indexDir) throws IOException {
    if (languageModel == null) {
      languageModel = new LuceneLanguageModel(indexDir);
    }
    return languageModel;
  }
View Full Code Here

    //langTool.activateDefaultPatternRules();
    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);
  }
View Full Code Here

    langTool = new JLanguageTool(new BritishEnglish());
    langTool.activateDefaultPatternRules();
    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);
View Full Code Here

TOP

Related Classes of org.languagetool.languagemodel.LuceneLanguageModel$LuceneSearcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.