2014-12-12 2 views
0

스탠포드 CoreNLP 파이프 라인을 사용하고 있으며 SentencesAnnotation에서 TreeAnnotation 및 BasicDependenciesAnnotation을 받고 있습니다.
POS 태그 및 종속성 구조에 대한 파서가 얼마나 확실한 지 알려줄 방법을 찾고 있습니다.스탠포드 NLP 주석 순위 또는 점수

나는 이전에 스탠포드 NLP 라이브러리를 조작하는 동안 동일한 문장에 대해 반환 된 순위가 다른 복수형 트리를 보았습니다. 파서 또는 파이프 라인에서이 정보를 가져 오는 방법에 대한 정보를 찾을 수 없습니다.

"DependencyScoring"클래스는 "TypedDependency"에서 작동하는 것으로 보이지만 주석 처리의 일부로 파이프 라인이 생성되는 것은 아닙니다.

편집 : 코드 세부 정보 :

Annotation document = new Annotation("This is my sentence"); 
pipeline.annotate(document); 
List<CoreMap> sentences = document.get(SentencesAnnotation.class); 
... 
Tree tree = sentence1.get(TreeAnnotation.class); 
SemanticGraph dependencies = sentence1.get(CollapsedCCProcessedDependenciesAnnotation.class); 
+1

어떻게 의존성 구문 분석을 작성합니까? 당신은'parse' 주석으로부터 그것들을 얻고 있습니까? 이 경우 종속성은 결정 성 전환에 의해 실제로 생성됩니다. 확률의 유일한 측정은 변환이 시작되는 PCFG 구문 분석에서 비롯됩니다. 이것이 사실이라면 나는 더 자세한 정보를 제공 할 수있다. –

+0

기본적으로 "Annotation document = new Annotation ("This is my sentence "); pipeline.annotate (document); 목록 문장 = document.get (SentencesAnnotation.class);" 그런 다음 TreeAnnotation 및 Dependency Graph를 가져옵니다. 예, PCFG 방식에 대해 자세히 설명해주십시오. –

+0

@JonGauthier 또한, 의존성 관계에서 단어 쌍의 우도/확률을 볼 수 있습니까? 예 : "MD"-> "JJ"또는 "will"-> "able"관계에 어떻게 걸릴 것입니까? 원하면 별도의 질문으로 게시 할 수 있습니다. –

답변

0

당신이합니다 (parse 주석 자하지 depparse으로, 즉) 기본 CoreNLP 파이프 라인을 사용하는 경우 종속성은 당신이보고있는 구문 분석은 결정적 전환에서 오는 선거구의 선거구 분석. 여기서 얻을 수있는 가장 좋은 "점수"는 일 것입니다. 후보 선거구 구가인데 결과적으로 의존성 분석 (변환 후)이 발생합니다.

그러나이 특정 작업을 수행하려면 CoreNLP 파이프 라인을 벗어나야합니다.

List<CoreLabel> mySentence = ... 

LexicalizedParser parser = LexicalizedParser.loadModel("edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz"); 
ParserQuery pq = parser.parserQuery(); 
if (pq.parse(mySentence)) { 
    // Get best parse and associated score 
    Tree parse = pq.getBestPCFGParse(); 
    double score = pq.getPCFGScore(); 

    // Print parse 
    parse.pennPrint(); 

    // ---- 
    // Get collection of best parses 
    List<ScoredObject<Tree>> bestParses = pq.getBestPCFGParses(); 

    // ---- 
    // Convert a constituency parse to dependency representation 
    GrammaticalStructure gs = parser.treebankLanguagePack() 
     .grammaticalStructureFactory().newGrammaticalStructure(parse); 
    List<TypedDependency> dependencies = gs.typedDependenciesCCprocessed(); 
    System.out.println(dependencies); 
} 

관련 자바 독 :

(주의 : 테스트되지 않은 코드이지만이 코드는 작동해야합니다.)

관련 문제