久久久久久久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 - 我的方法合理嗎?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我的目標(biāo)是利用 Lucene 的許多標(biāo)記器和過濾器來轉(zhuǎn)換輸入文本,但不創(chuàng)建任何索引.

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

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

                  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 的方式,因?yàn)槲乙郧皬奈聪襁@樣使用過它們.感覺很笨重.

                  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 導(dǎo)入:

                  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();
                  }
                  

                  推薦答案

                  我已經(jīng)使用這個(gè)設(shè)置幾個(gè)星期了,沒有問題.我還沒有找到更簡潔的方法.我認(rèn)為問題中的代碼是可以的.

                  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.

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

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

                  相關(guān)文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數(shù)溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關(guān)系嗎?)
                  How to convert Integer to int?(如何將整數(shù)轉(zhuǎn)換為整數(shù)?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內(nèi)創(chuàng)建一個(gè)隨機(jī)打亂數(shù)字的 int 數(shù)組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠?qū)?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>
                            主站蜘蛛池模板: 国产美女一区二区三区 | 国产免费一区二区 | 成人精品国产免费网站 | 亚洲欧美精品一区 | 波多野结衣精品 | 精品国产免费一区二区三区演员表 | 国产小视频在线 | 欧美成人一区二区三区 | 国产精品久久国产精品 | 91亚洲精选 | 国产一区二区中文字幕 | 在线视频国产一区 | 欧美淫片 | 91久久国产综合久久 | 国产成人精品一区二区三区四区 | 久久久久久亚洲精品 | 精品一区免费 | 国产精品久久久久久久久久三级 | 国产亚洲成av人片在线观看桃 | 黑人巨大精品欧美一区二区免费 | 91亚洲国产成人精品一区二三 | 欧美群妇大交群中文字幕 | av免费入口 | av片网 | 免费高清成人 | 99成人 | 国产精品久久久久久久久久久新郎 | 黄免费观看视频 | 天天色综 | 日韩在线免费 | 国产精品完整版 | 国产成人久久精品 | 久久伊人亚洲 | 国产精品99999999 | 精品久久成人 | 久久久久久九九九九 | 色视频成人在线观看免 | 欧美午夜在线 | 久久久久国产精品免费免费搜索 | 日本一区二区三区免费观看 | 久热中文字幕 |