org.apache.lucene.analysis.synonym.WordnetSynonymParser.parse()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中org.apache.lucene.analysis.synonym.WordnetSynonymParser.parse()方法的一些代码示例,展示了WordnetSynonymParser.parse()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WordnetSynonymParser.parse()方法的具体详情如下:
包路径:org.apache.lucene.analysis.synonym.WordnetSynonymParser
类名称:WordnetSynonymParser
方法名:parse

WordnetSynonymParser.parse介绍

暂无

代码示例

代码示例来源:origin: lindstromhenrik/elasticsearch-analysis-file-watcher-synonym

@Override
  public void run() {
    try {
      File synonymFile = new File(synonymFileURL.toURI());
      if(synonymFile.exists() && lastModified < synonymFile.lastModified())
      {
        Reader rulesReader = new InputStreamReader(synonymFileURL.openStream(), Charsets.UTF_8);
        SynonymMap.Builder parser = null;
        if ("wordnet".equalsIgnoreCase(format)) {
          parser = new WordnetSynonymParser(true, expand, analyzer);
          ((WordnetSynonymParser) parser).parse(rulesReader);
        } else {
          parser = new SolrSynonymParser(true, expand, analyzer);
          ((SolrSynonymParser) parser).parse(rulesReader);
        }
        synonymMap = parser.build();
        lastModified = synonymFile.lastModified();
      }
    } catch (Exception e) {
      throw new RuntimeException("could not reload synonyms file: " + e.getMessage());
    }
  }
}

代码示例来源:origin: bells/elasticsearch-analysis-dynamic-synonym

static SynonymMap.Builder getSynonymParser(Reader rulesReader, String format, boolean expand, Analyzer analyzer) throws IOException, ParseException {
  SynonymMap.Builder parser;
  if ("wordnet".equalsIgnoreCase(format)) {
    parser = new WordnetSynonymParser(true, expand, analyzer);
    ((WordnetSynonymParser) parser).parse(rulesReader);
  } else {
    parser = new SolrSynonymParser(true, expand, analyzer);
    ((SolrSynonymParser) parser).parse(rulesReader);
  }
  return parser;
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

((WordnetSynonymParser) parser).parse(rulesReader);
} else {
  parser = new SolrSynonymParser(true, expand, analyzer);

代码示例来源:origin: lindstromhenrik/elasticsearch-analysis-file-watcher-synonym

((WordnetSynonymParser) parser).parse(rulesReader);
} else {
  parser = new SolrSynonymParser(true, expand, analyzer);

相关文章