首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用indri在java中索引?

如何使用indri在java中索引?
EN

Stack Overflow用户
提问于 2015-11-24 08:22:24
回答 1查看 603关注 0票数 2
代码语言:javascript
复制
import lemurproject.indri.*;
import java.io.*;

public class Indritest {

    public static void main(String[] args) throws Exception {

        String [] stopWordList =  {"a", "an", "and", "are", "as", "at", "be", 
                                  "by","for", "from", "has", "he", "in", "is",
                                  "it", "its", "of", "on", "that", "the", "to",
                                  "was", "were", "will", "with"};

        String myIndex = "C:/Program Files/lemur/lemur4.12/src/app/obj/myIndex5";

        try {
            IndexEnvironment envI = new IndexEnvironment();
            envI.setStoreDocs(true);

            // create an Indri repository
            envI.setMemory(256000000);

            envI.setStemmer("krovetz");
            envI.setStopwords(stopWordList);

            envI.setIndexedFields( new String[] {"article", "header", "p", "title", "link"}); 
            envI.open(myIndex);
            envI.create( myIndex );

            // add xml files to the just created index i.e myIndex
            // xml_data is a folder which contains the list of xml files to be added

            File filesDir = new File("C:/NetbeanProg2/xml_data"); 
            File[] files = filesDir.listFiles(); 
            int noOffiles = files.length; 
            for (int i = 0; i < noOffiles; i++) { 
                System.out.println(files[i].getCanonicalPath() + "\t" + files[i].getCanonicalFile()); 
                envI.addFile(files[i].getCanonicalPath(), "xml"); 
            }  
        } catch (Exception e) {
            System.out.println("issue is: " + e);
        }
    }
}

我从一个教程中找到了这段代码,但它不起作用。这给了我一个例外。

代码语言:javascript
复制
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files\Indri\Indri 5.9\bin\indri_jni.dll: Can't find dependent libraries

myindex变量中,我提供了IndexUI.jar文件的路径。我对indri很陌生。我对它的用法不太了解。我下载了indri 5.9

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-12-28 16:24:19

问题是indri的版本。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33888589

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档