简体   繁体   中英

Error in BabelNet 2.5 path index configuration

Following all the steps in this page and this , I have configured BabelNet for Windows in Eclipse.

It is working fine and loads all synsets from BabelNet. Then it needs knowldgeBasePathIndex and starts loading. In the first link it is specified such:

This begins to run, but fails because it cannot find something called the "path index" when trying to load the knowledge base. The location of the path index can be specified by putting a line in config/knowledge.var.properties: knowledge.graph.pathIndex=C:/Program Files/BabelNet/data

I have two queries concerning this:

  1. There is no knowledge.var.properties file in BabelNet 3.0. So, I switched to BabelNet 2.5.

  2. There is no such folder as data in BabelNet 2.5 but there is one in BabelNet 3.0. However still there are no path indices in either of them.

Because of this the program stops running.

Can anybody offer advice regarding this?

Thank you.

The program is here:

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);
}

Knowledge factory is deprecated in BabelNet API 2.5.1 and the "Precompiled Index Bundle v2.5.1" is not the necessary indices for that factory. We have not released "BabelNet path indices" after BabelNet 1.1.

for WSD task please use Babelfy (babelfy.org)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM