0

BabelFy를 사용하여 단어 목록을 명확하게하려고합니다. 나는 Babelfy의 API 페이지에서 제공된 예제로 시작했다. 하지만 나는 Babelfy에서 얻은 "열쇠"에 관한 오류를 가지고있다. 이미 파일을 키로 채 웠습니다. 그러나 그것은 그것이 비 었다고 말한다. 여기 Java에서 babelfy.properties가 누락되었습니다.

Nov 02, 2017 4:23:03 PM it.uniroma1.lcl.babelfy.commons.BabelfyConfiguration <init> 
INFO: babelfy.properties is missing. Please check that the file is available 
in the config folder. 
Nov 02, 2017 4:23:03 PM it.uniroma1.lcl.babelfy.commons.BabelfyConfiguration 
<init> 
INFO: Babelfy starts with empty configuration 
Exception in thread "main" java.lang.IllegalArgumentException: Please define 
the parameter babelfy.key in babelfy.properties in the config folder. 

내 코드입니다 : 속성

babelfy.key=<the key> 

enter image description here

답변

0
저도 같은 문제가 발생했다

파일 여기에

public class WSDBabelfy { 
    public static void main (String args[]){ 
     String inputText = "BabelNet is both a multilingual encyclopedic dictionary and a semantic network"; 
     BabelfyConstraints constraints = new BabelfyConstraints(); 
     SemanticAnnotation a = new SemanticAnnotation(new TokenOffsetFragment(0, 0), "<the key>", 
       "http://dbpedia.org/resource/BabelNet", SemanticAnnotation.Source.OTHER); 

     constraints.addAnnotatedFragments(a); 
     BabelfyParameters bp = new BabelfyParameters(); 
     bp.setAnnotationResource(BabelfyParameters.SemanticAnnotationResource.BN); 
     bp.setMCS(BabelfyParameters.MCS.ON_WITH_STOPWORDS); 
     bp.setScoredCandidates(BabelfyParameters.ScoredCandidates.ALL); 
     Babelfy bfy = new Babelfy(bp); 
     List<SemanticAnnotation> bfyAnnotations = bfy.babelfy(inputText, Language.EN, constraints); 
    //bfyAnnotations is the result of Babelfy.babelfy() call 
     for (SemanticAnnotation annotation : bfyAnnotations) 
     { 
      //splitting the input text using the CharOffsetFragment start and end anchors 
      String frag = inputText.substring(annotation.getCharOffsetFragment().getStart(), 
        annotation.getCharOffsetFragment().getEnd() + 1); 
      System.out.println(frag + "\t" + annotation.getBabelSynsetID()); 
      System.out.println("\t" + annotation.getBabelNetURL()); 
      System.out.println("\t" + annotation.getDBpediaURL()); 
      System.out.println("\t" + annotation.getSource()); 
     } 
    } 
} 

그리고, config 폴더가에 잘 프로젝트의 루트? 또한 아래 예제 (또는 IDE)와 같이 classpath에 포함 시키시겠습니까?

java -classpath lib/*:babelfy-online-1.0.jar:config it.uniroma1.lcl.babelfy.demo.BabelfyDemo

+0

나는 보통 클래스 경로에 모든 것을 만들기 위해이 링크 "https://stackoverflow.com/questions/6104551/java-setting-classpath"를 사용합니다. 하지만 나는 Classaeth에서 어디에 써야하는지 잘 모릅니다. 힌트를주세요. – Raha1986

+0

IntelliJ IDEA와 같은 IDE를 사용하고 있습니까? 게다가 위에서 언급 한 라인을 실행하는 것은 classpath에 필요한 모든 것을 포함한다 : (1)'lib /'의 모든'.jar' 파일; (2) 프로젝트의 루트에 'babelfy-online-1.0.jar'이 있다고 가정합니다. (3)'config /'폴더에 2 개의 등록 정보 파일이 있습니다. – Marc