久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='ZUAGd'><style id='ZUAGd'><dir id='ZUAGd'><q id='ZUAGd'></q></dir></style></legend>
    <tfoot id='ZUAGd'></tfoot>

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

      <i id='ZUAGd'><tr id='ZUAGd'><dt id='ZUAGd'><q id='ZUAGd'><span id='ZUAGd'><b id='ZUAGd'><form id='ZUAGd'><ins id='ZUAGd'></ins><ul id='ZUAGd'></ul><sub id='ZUAGd'></sub></form><legend id='ZUAGd'></legend><bdo id='ZUAGd'><pre id='ZUAGd'><center id='ZUAGd'></center></pre></bdo></b><th id='ZUAGd'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ZUAGd'><tfoot id='ZUAGd'></tfoot><dl id='ZUAGd'><fieldset id='ZUAGd'></fieldset></dl></div>

        <bdo id='ZUAGd'></bdo><ul id='ZUAGd'></ul>

        在沒有索引的情況下使用 Lucene Analyzer - 我的方法

        Using Lucene Analyzer Without Indexing - Is My Approach Reasonable?(在沒有索引的情況下使用 Lucene Analyzer - 我的方法合理嗎?)

              <tbody id='Bszq9'></tbody>
          1. <i id='Bszq9'><tr id='Bszq9'><dt id='Bszq9'><q id='Bszq9'><span id='Bszq9'><b id='Bszq9'><form id='Bszq9'><ins id='Bszq9'></ins><ul id='Bszq9'></ul><sub id='Bszq9'></sub></form><legend id='Bszq9'></legend><bdo id='Bszq9'><pre id='Bszq9'><center id='Bszq9'></center></pre></bdo></b><th id='Bszq9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Bszq9'><tfoot id='Bszq9'></tfoot><dl id='Bszq9'><fieldset id='Bszq9'></fieldset></dl></div>
            <tfoot id='Bszq9'></tfoot>

                  <bdo id='Bszq9'></bdo><ul id='Bszq9'></ul>
                • <small id='Bszq9'></small><noframes id='Bszq9'>

                  <legend id='Bszq9'><style id='Bszq9'><dir id='Bszq9'><q id='Bszq9'></q></dir></style></legend>
                  本文介紹了在沒有索引的情況下使用 Lucene Analyzer - 我的方法合理嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我的目標是利用 Lucene 的許多標記器和過濾器來轉換輸入文本,但不創建任何索引.

                  My objective is to leverage some of Lucene's many tokenizers and filters to transform input text, but without the creation of any indexes.

                  例如,給定這個(人為的)輸入字符串...

                  For example, given this (contrived) input string...

                  " 某人的 - [texté] 在這里,foo ."

                  ...還有像這樣的 Lucene 分析器...

                  ...and a Lucene analyzer like this...

                  Analyzer analyzer = CustomAnalyzer.builder()
                          .withTokenizer("icu")
                          .addTokenFilter("lowercase")
                          .addTokenFilter("icuFolding")
                          .build();
                  

                  我想得到以下輸出:

                  某人的文本在這里 foo

                  下面的 Java 方法可以滿足我的需求.

                  The below Java method does what I want.

                  但有沒有更好(即更典型和/或更簡潔)的方式讓我這樣做?

                  我特別想的是我使用 TokenStreamCharTermAttribute 的方式,因為我以前從未像這樣使用過它們.感覺很笨重.

                  I am specifically thinking about the way I have used TokenStream and CharTermAttribute, since I have never used them like this before. Feels clunky.

                  代碼如下:

                  Lucene 8.3.0 導入:

                  Lucene 8.3.0 imports:

                  import org.apache.lucene.analysis.Analyzer;
                  import org.apache.lucene.analysis.TokenStream;
                  import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
                  import org.apache.lucene.analysis.custom.CustomAnalyzer;
                  

                  我的方法:

                  private String transform(String input) throws IOException {
                  
                      Analyzer analyzer = CustomAnalyzer.builder()
                              .withTokenizer("icu")
                              .addTokenFilter("lowercase")
                              .addTokenFilter("icuFolding")
                              .build();
                  
                      TokenStream ts = analyzer.tokenStream("myField", new StringReader(input));
                      CharTermAttribute charTermAtt = ts.addAttribute(CharTermAttribute.class);
                  
                      StringBuilder sb = new StringBuilder();
                      try {
                          ts.reset();
                          while (ts.incrementToken()) {
                              sb.append(charTermAtt.toString()).append(" ");
                          }
                          ts.end();
                      } finally {
                          ts.close();
                      }
                      return sb.toString().trim();
                  }
                  

                  推薦答案

                  我已經使用這個設置幾個星期了,沒有問題.我還沒有找到更簡潔的方法.我認為問題中的代碼是可以的.

                  I have been using this set-up for a few weeks without issue. I have not found a more concise approach. I think the code in the question is OK.

                  這篇關于在沒有索引的情況下使用 Lucene Analyzer - 我的方法合理嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)

                      <tfoot id='lsq4U'></tfoot>

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

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

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

                              <tbody id='lsq4U'></tbody>
                            主站蜘蛛池模板: 国产最新网址 | 日韩国产欧美一区 | 美女在线视频一区二区三区 | 男人亚洲天堂 | 久久久久久久一级 | 国产福利网站 | h在线播放| 一级黄色片一级黄色片 | 精品国模一区二区三区欧美 | 狠狠的操| 日本一二三区高清 | 喷潮网站 | 一区二区三区视频 | 91影院在线观看 | 一区二区三区视频免费观看 | 国产精品久久久久久久久久不蜜臀 | 伊人国产精品 | 午夜精品一区 | 天堂av中文 | 精品成人av | 亚洲va欧美va天堂v国产综合 | 69精品久久久久久 | 91麻豆久久久 | 中文字幕国产 | 亚洲综合在线一区 | 国产ts人妖另类 | 欧美最猛黑人xxxx黑人 | www.日本三级| 无码一区二区三区视频 | 免费久久网站 | 一级免费视频 | 久久久久久免费毛片精品 | 丁香五月缴情综合网 | 天天操网 | 日本精品久久久久久久 | 日韩精品在线网站 | 日韩午夜一区二区三区 | 成人三级视频在线观看 | 亚洲成人黄色 | 亚洲精品国产第一综合99久久 | 国产一区二区视频免费在线观看 |