1

按照本页本页中的所有步骤,我已经在 Eclipse 中为 Windows 配置了 BabelNet。

它工作正常并从 BabelNet 加载所有同义词集。然后它需要 knowldgeBasePathIndex 并开始加载。在第一个链接中,它被指定为:

这开始运行,但由于在尝试加载知识库时找不到称为“路径索引”的东西而失败。路径索引的位置可以通过在 config/knowledge.var.properties 中放一行来指定:knowledge.graph.pathIndex=C:/Program Files/BabelNet/data

我对此有两个疑问:

  1. BabelNet 3.0 中没有 Knowledge.var.properties 文件。所以,我切换到 BabelNet 2.5。

  2. BabelNet 2.5 中没有 data 这样的文件夹,但 BabelNet 3.0 中有一个。但是,它们中的任何一个都没有路径索引。

因此,程序停止运行。

有人可以就此提供建议吗?

谢谢你。

程序在这里:

public static void disambiguate(Collection<Word> words, KnowledgeBase kb, KnowledgeGraphScorer scorer) 
    {
        try
        {
        BabelNet bn = BabelNet.getInstance();
        System.out.println("SYNSETS WITH English word: \"bank\"");
        List<BabelSynset> synsets = bn.getSynsets(Language.EN, "bank");
        for (BabelSynset synset : synsets)
        {
        System.out.print(" =>(" + synset.getId() + ") SOURCE: " + synset.getSynsetSource() +"; WN SYNSET: " + synset.getWordNetOffsets() +";\n SENSES (EN): { ");
        for (BabelSense sense : synset.getSenses(Language.EN))
        System.out.print(sense.toString()+" ");
        System.out.println("}\n -----");
        Map<IPointer, List<BabelSynset>> relatedSynsets = synset.getRelatedMap();
        for (IPointer relationType : relatedSynsets.keySet()) 
        {
        List<BabelSynset> relationSynsets = relatedSynsets.get(relationType);
        for (BabelSynset relationSynset : relationSynsets) 
        {
        System.out.println(" EDGE " + relationType.getSymbol() +" " + relationSynset.getId() +" " + relationSynset.toString(Language.EN));
        }
        }
        System.out.println(" -----");
        KnowledgeGraphFactory factory = KnowledgeGraphFactory.getInstance(kb);
        KnowledgeGraph kGraph = factory.getKnowledgeGraph(words);
        Map<String, Double> scores = scorer.score(kGraph);
        for (String concept : scores.keySet()) 
        {
        double score = scores.get(concept);
        for (Word word : kGraph.wordsForConcept(concept))
        word.addLabel(concept, score);
        }
        for (Word word : words) 
        {
        System.out.println("\n\t" + word.getWord() + " -- ID " + word.getId() +" => SENSE DISTRIBUTION: ");
        for (ScoredItem<String> label : word.getLabels()) 
        {
        System.out.println("\t [" + label.getItem() + "]:" +Strings.format(label.getScore()));
        }
        }
        }
        }
        catch(IOException ioe)
        {
            System.out.println("Trouble: " + ioe.getMessage());
        } 
}
public static void main(String[] args) {
List<Word> sentence = Arrays.asList(new Word[]{new Word("bank", ’n’,     Language.EN), new Word("bonus", ’n’, Language.EN),new Word("pay", ’v’, Language.EN), new Word("stock", ’n’, Language.EN)});
disambiguate(sentence, KnowledgeBase.BABELNET, KnowledgeGraphScorer.DEGREE);
}
4

1 回答 1

1

知识工厂在 BabelNet API 2.5.1 中已弃用,并且“预编译索引包 v2.5.1”不是该工厂的必要索引。在 BabelNet 1.1 之后,我们还没有发布“BabelNet 路径索引”。

对于 WSD 任务,请使用Babelfy (babelfy.org)

于 2016-01-22T11:50:58.127 回答