BabelNet 2.5 路径索引配置错误
Error in BabelNet 2.5 path index configuration
按照 page and this 中的所有步骤,我已经在 Eclipse 中为 Windows 配置了 BabelNet。
它工作正常并从 BabelNet 加载所有同义词集。然后它需要 knowldgeBasePathIndex 并开始加载。在第一个 link 中指定为:
这开始于 运行,但失败了,因为它在尝试加载知识库时找不到名为 "path index" 的东西。可以通过在 config/knowledge.var.properties 中放置一行来指定路径索引的位置:
knowledge.graph.pathIndex=C:/程序Files/BabelNet/data
我有两个关于此的问题:
BabelNet 3.0中没有knowledge.var.properties文件。所以,我切换到 BabelNet 2.5.
BabelNet 2.5没有data这个文件夹,BabelNet 3.0有。但是它们中仍然没有路径索引。
因此程序停止 运行ning。
有人可以就此提供建议吗?
谢谢。
节目在这里:
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);
}
知识工厂在 BabelNet API 2.5.1 中被弃用,"Precompiled Index Bundle v2.5.1" 不是该工厂的必要索引。 BabelNet 1.1 之后我们还没有发布"BabelNet path indices"。
对于 WSD 任务,请使用 Babelfy (babelfy.org)
按照 page and this 中的所有步骤,我已经在 Eclipse 中为 Windows 配置了 BabelNet。
它工作正常并从 BabelNet 加载所有同义词集。然后它需要 knowldgeBasePathIndex 并开始加载。在第一个 link 中指定为:
这开始于 运行,但失败了,因为它在尝试加载知识库时找不到名为 "path index" 的东西。可以通过在 config/knowledge.var.properties 中放置一行来指定路径索引的位置: knowledge.graph.pathIndex=C:/程序Files/BabelNet/data
我有两个关于此的问题:
BabelNet 3.0中没有knowledge.var.properties文件。所以,我切换到 BabelNet 2.5.
BabelNet 2.5没有data这个文件夹,BabelNet 3.0有。但是它们中仍然没有路径索引。
因此程序停止 运行ning。
有人可以就此提供建议吗?
谢谢。
节目在这里:
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);
}
知识工厂在 BabelNet API 2.5.1 中被弃用,"Precompiled Index Bundle v2.5.1" 不是该工厂的必要索引。 BabelNet 1.1 之后我们还没有发布"BabelNet path indices"。
对于 WSD 任务,请使用 Babelfy (babelfy.org)