0

我尝试使用 TML 库实现 LSA 语义搜索。这是我的代码,其中 rep1 是我创建的文件夹,而 dossier 是我放置 txt 文档的文件夹。

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

        Repository repository = new Repository("C:\rep1");

        repository.addDocumentsInFolder("C:/dossier");

        System.out.println("Documents added to repository successfully!");

        SearchResultsCorpus corpus = new SearchResultsCorpus("type:document");
        corpus.getParameters().setTermSelectionCriterion(TermSelection.DF);
        corpus.getParameters().setTermSelectionThreshold(0);
        corpus.getParameters().setDimensionalityReduction(DimensionalityReduction.NUM);
        corpus.getParameters().setDimensionalityReductionThreshold(50);
        corpus.getParameters().setTermWeightGlobal(GlobalWeight.Entropy);
        corpus.getParameters().setTermWeightLocal(LocalWeight.LOGTF);
        corpus.load(repository);

        System.out.println("Corpus loaded and Semantic space calculated");
        System.out.println("Total documents:" + corpus.getPassages().length);

        PassagesSimilarity distances = new PassagesSimilarity();
        distances.setCorpus(corpus);
        distances.start();

        distances.printResults();


    }

但我有这个错误!

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/index/CorruptIndexException
    at main.org.java.PerformingOperationOnCorpus.main(PerformingOperationOnCorpus.java:15)
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.index.CorruptIndexException
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)

提前致谢

4

0 回答 0