<legend id='0aEyF'><style id='0aEyF'><dir id='0aEyF'><q id='0aEyF'></q></dir></style></legend>
<i id='0aEyF'><tr id='0aEyF'><dt id='0aEyF'><q id='0aEyF'><span id='0aEyF'><b id='0aEyF'><form id='0aEyF'><ins id='0aEyF'></ins><ul id='0aEyF'></ul><sub id='0aEyF'></sub></form><legend id='0aEyF'></legend><bdo id='0aEyF'><pre id='0aEyF'><center id='0aEyF'></center></pre></bdo></b><th id='0aEyF'></th></span></q></dt></tr></i><div id='0aEyF'><tfoot id='0aEyF'></tfoot><dl id='0aEyF'><fieldset id='0aEyF'></fieldset></dl></div>
  • <tfoot id='0aEyF'></tfoot>
      <bdo id='0aEyF'></bdo><ul id='0aEyF'></ul>

    <small id='0aEyF'></small><noframes id='0aEyF'>

      1. 有谁知道如何使用带有 Lucene 3.6 的 Wordnet 扩展查

        时间:2023-09-29

          <small id='DvDxW'></small><noframes id='DvDxW'>

              <tbody id='DvDxW'></tbody>
          • <i id='DvDxW'><tr id='DvDxW'><dt id='DvDxW'><q id='DvDxW'><span id='DvDxW'><b id='DvDxW'><form id='DvDxW'><ins id='DvDxW'></ins><ul id='DvDxW'></ul><sub id='DvDxW'></sub></form><legend id='DvDxW'></legend><bdo id='DvDxW'><pre id='DvDxW'><center id='DvDxW'></center></pre></bdo></b><th id='DvDxW'></th></span></q></dt></tr></i><div id='DvDxW'><tfoot id='DvDxW'></tfoot><dl id='DvDxW'><fieldset id='DvDxW'></fieldset></dl></div>
              <bdo id='DvDxW'></bdo><ul id='DvDxW'></ul>

                <legend id='DvDxW'><style id='DvDxW'><dir id='DvDxW'><q id='DvDxW'></q></dir></style></legend>

                  <tfoot id='DvDxW'></tfoot>

                1. 本文介绍了有谁知道如何使用带有 Lucene 3.6 的 Wordnet 扩展查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我在 org.apache.lucene.analysis.synonym 中找到了 WordnetSynonymParser 类,但在 API 和 google 中都没有使用示例.有谁有这方面的经验吗?

                  I've found the class WordnetSynonymParser in org.apache.lucene.analysis.synonym but there aren't examples of its usage neither in the API nor in google. Does any one have experience with it?

                  谢谢!

                  编辑:我知道以前有类 SynExpand,但是在 3.6 版本中它消失了...

                  EDIT: I know that there used to be the class SynExpand, but with version 3.6 it disappeared...

                  我试试:

                             try {
                                     FileReader rulesReader = new FileReader("wn/wn_s.pl");
                                 SynonymMap.Builder parser = null;
                                 parser = new WordnetSynonymParser(true, true, analyzer);
                                 ((WordnetSynonymParser)parser).add(rulesReader);          
                                 synonymMap = parser.build();
                              } catch (Exception e) {
                                              e.printStackTrace();
                                              System.exit(1);
                              }
                  

                  但我收到以下错误:

                  java.text.ParseException: Invalid synonym rule at line 109
                          at org.apache.lucene.analysis.synonym.WordnetSynonymParser.add(WordnetSynonymParser.java:75)
                          at pirServer.QueryClassifier.<init>(QueryClassifier.java:77)
                          at pirServer.PIRServer.main(PIRServer.java:32)
                  Caused by: java.lang.IllegalArgumentException: term: course of action analyzed to a token with posinc != 1
                          at org.apache.lucene.analysis.synonym.SynonymMap$Builder.analyze(SynonymMap.java:131)
                          at org.apache.lucene.analysis.synonym.WordnetSynonymParser.parseSynonym(WordnetSynonymParser.java:92)
                          at org.apache.lucene.analysis.synonym.WordnetSynonymParser.add(WordnetSynonymParser.java:67)
                          ... 2 more 
                  

                  推荐答案

                  我正在做类似的事情,只是阅读了文档 - 所以 SynonymFilter 文档中的相关警告非常新鲜:

                  I am working on a similar thing and just read the documentation - so a relevant caution from the SynonymFilter doc is very fresh:

                  ""此令牌流无法正确处理位置增量!= 1,即您应该在过滤掉停用词之前放置此过滤器""

                  ""This token stream cannot properly handle position increments != 1, ie, you should place this filter before filtering out stop words""

                  http://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/analysis/synonym/SynonymFilter.html

                  您传递给 WordNetSynonymParser 的分析器(您没有在帖子中描述)可能会删除停用词(大多数情况下都是如此),从而导致:

                  It's possible that the analyzer you're passing (which you fail to describe in your post) to the WordNetSynonymParser does remove stop words (as is the case for most of them) causing:

                  java.lang.IllegalArgumentException: term: 使用 posinc != 1 分析到令牌的操作过程

                  java.lang.IllegalArgumentException: term: course of action analyzed to a token with posinc != 1

                  这篇关于有谁知道如何使用带有 Lucene 3.6 的 Wordnet 扩展查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 Lucene 中进行多字段 - 短语搜索? 下一篇:如何在 Lucene 中仅标记某些单词

                  相关文章

                  最新文章

                  1. <tfoot id='MShFs'></tfoot>

                  2. <i id='MShFs'><tr id='MShFs'><dt id='MShFs'><q id='MShFs'><span id='MShFs'><b id='MShFs'><form id='MShFs'><ins id='MShFs'></ins><ul id='MShFs'></ul><sub id='MShFs'></sub></form><legend id='MShFs'></legend><bdo id='MShFs'><pre id='MShFs'><center id='MShFs'></center></pre></bdo></b><th id='MShFs'></th></span></q></dt></tr></i><div id='MShFs'><tfoot id='MShFs'></tfoot><dl id='MShFs'><fieldset id='MShFs'></fieldset></dl></div>

                  3. <small id='MShFs'></small><noframes id='MShFs'>

                    <legend id='MShFs'><style id='MShFs'><dir id='MShFs'><q id='MShFs'></q></dir></style></legend>
                        <bdo id='MShFs'></bdo><ul id='MShFs'></ul>