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

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

    <small id='3GpZ0'></small><noframes id='3GpZ0'>

      1. Lucene 4.0 中的詞頻

        Term frequency in Lucene 4.0(Lucene 4.0 中的詞頻)
      2. <tfoot id='NjUb6'></tfoot>

                <tbody id='NjUb6'></tbody>

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

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

                  本文介紹了Lucene 4.0 中的詞頻的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  嘗試使用 Lucene 4.0 計算詞頻.我的文檔頻率工作得很好,但不知道如何使用 API 來做詞頻.這是我的代碼:

                  Trying to calculate term frequency using Lucene 4.0. I got document frequency working just fine, but can't figure out how to do term frequency using the API. Here's the code I have:

                  private static void addDoc(IndexWriter writer, String content) throws IOException {
                      FieldType fieldType = new FieldType();
                      fieldType.setStoreTermVectors(true);
                      fieldType.setStoreTermVectorPositions(true);
                      fieldType.setIndexed(true);
                      fieldType.setIndexOptions(IndexOptions.DOCS_AND_FREQS);
                      fieldType.setStored(true);
                      Document doc = new Document();
                      doc.add(new Field("content", content, fieldType));
                      writer.addDocument(doc);
                  }
                  
                  public static void main(String[] args) throws IOException, ParseException {
                      Directory directory = new RAMDirectory();  
                      Analyzer analyzer = new WhitespaceAnalyzer(Version.LUCENE_40);
                      IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer);
                      IndexWriter writer = new IndexWriter(directory, config);
                      addDoc(writer, "Lucene is stupid");
                      addDoc(writer, "Java is great");
                      writer.close();
                      IndexReader reader = DirectoryReader.open(directory);
                      System.out.println(reader.docFreq(new Term("content", "Lucene")));
                      reader.close();
                  }
                  

                  我嘗試過執行類似 reader.getTermVector(0, "content")... 的操作,但找不到僅獲取該文檔中特定術語頻率的方法.

                  I've tried doing something like reader.getTermVector(0, "content")... but can't find a method to just get the frequency of a particular term in that document.

                  謝謝!

                  推薦答案

                  K,想通了.您可以從 MultiFields 獲取 DocsEnum 對象,然后對其進行迭代.

                  K, figured it out. You can get a DocsEnum object from MultiFields, and then iterate over that.

                  private static void addDoc(IndexWriter writer, String content) throws IOException {
                      FieldType fieldType = new FieldType();
                      fieldType.setStoreTermVectors(true);
                      fieldType.setStoreTermVectorPositions(true);
                      fieldType.setIndexed(true);
                      fieldType.setIndexOptions(IndexOptions.DOCS_AND_FREQS);
                      fieldType.setStored(true);
                      Document doc = new Document();
                      doc.add(new Field("content", content, fieldType));
                      writer.addDocument(doc);
                  }
                  
                  public static void main(String[] args) throws IOException, ParseException {
                      Directory directory = new RAMDirectory();  
                      Analyzer analyzer = new WhitespaceAnalyzer(Version.LUCENE_40);
                      IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer);
                      IndexWriter writer = new IndexWriter(directory, config);
                      addDoc(writer, "bla bla bla bleu bleu");
                      addDoc(writer, "bla bla bla bla");
                      writer.close();
                      DirectoryReader reader = DirectoryReader.open(directory);
                      DocsEnum de = MultiFields.getTermDocsEnum(reader, MultiFields.getLiveDocs(reader), "content", new BytesRef("bla"));
                      int doc;
                      while((doc = de.nextDoc()) != DocsEnum.NO_MORE_DOCS) {
                            System.out.println(de.freq());
                      }
                      reader.close();
                  }
                  

                  這篇關于Lucene 4.0 中的詞頻的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)
                    <tbody id='fACZm'></tbody>
                  <legend id='fACZm'><style id='fACZm'><dir id='fACZm'><q id='fACZm'></q></dir></style></legend>
                  <tfoot id='fACZm'></tfoot>

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

                          • <small id='fACZm'></small><noframes id='fACZm'>

                            主站蜘蛛池模板: 亚洲日韩中文字幕一区 | 精品欧美激情精品一区 | 国内自拍偷拍一区 | 美女视频久久 | 一区二区三区视频 | 亚洲免费成人av | 亚洲二区视频 | 欧美精品一二三区 | 日韩伦理一区二区 | 欧美视频中文字幕 | 欧美精品a∨在线观看不卡 国产精品久久国产精品 | 日韩av在线中文字幕 | 玖草资源| 国产成人精品在线 | 羞羞视频网站 | 我要看一级片 | 亚洲国产精品久久久 | 风间由美一区二区三区在线观看 | 热久色| 久久久爽爽爽美女图片 | 新超碰97 | 一二区成人影院电影网 | 天天操 夜夜操 | 国产色婷婷精品综合在线手机播放 | 蜜桃特黄a∨片免费观看 | 91精品久久久久久久久久入口 | 久久精品免费 | 日韩精品久久一区 | 国产资源在线视频 | 亚洲精品永久免费 | 99热在这里只有精品 | 欧美国产日韩在线 | 97超碰成人 | 成人免费视频观看 | 亚洲精品日本 | 希岛爱理在线 | 欧美三级在线 | 欧美久久一区二区三区 | 亚洲精品一区国产精品 | 日本在线看 | 成人日韩 |