获取 Galago 中的词汇列表

Get vocabulary list in Galago

我正在使用 Galago 检索工具包(Lemur 项目的一部分),我需要一个集合中所有词汇术语的列表(所有唯一术语)。其实我需要 List <String>Set <String> 非常感谢让我知道如何获得这样的列表?

`DumpKeysFn'class 似乎给出了集合的所有键(唯一项)。代码应该是这样的:

public static Set <String> getAllVocabularyTerms (String fileName) throws IOException{
    Set <String> result = new HashSet<> ();
    IndexPartReader reader = DiskIndex.openIndexPart(fileName);
    if (reader.getManifest().get("emptyIndexFile", false)) {
        // do something!
    }

    KeyIterator iterator = reader.getIterator();
    while (!iterator.isDone()) {
      result.add(iterator.getKeyString());
      iterator.nextKey();
    }
    reader.close();
    return result;
}