Package org.languagetool.tagging.disambiguation.rules

Examples of org.languagetool.tagging.disambiguation.rules.DisambiguationRuleLoader


  @Override
  public AnalyzedSentence disambiguate(AnalyzedSentence input) throws IOException {
    AnalyzedSentence sentence = input;
    String filePath = "/disambiguator.xml";
    try (InputStream inputStream = getClass().getResourceAsStream(filePath)) {
      final DisambiguationRuleLoader ruleLoader = new DisambiguationRuleLoader();
      List<DisambiguationPatternRule> disambiguationRules = ruleLoader.getRules(inputStream);
      for (final DisambiguationPatternRule patternRule : disambiguationRules) {
        sentence = patternRule.replace(sentence);
      }
    } catch (Exception e) {
      throw new RuntimeException("Problems with loading disambiguation file: " + filePath, e);
View Full Code Here

TOP

Related Classes of org.languagetool.tagging.disambiguation.rules.DisambiguationRuleLoader

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.