3

edu.stanford.nlp パッケージの Semgrex が必要だと思います。このタスクでは、edu.stanford.nlp.trees.Tree から Tree を構築し、そのツリーを次のように処理する必要があります。

import edu.stanford.nlp.semgraph.semgrex.SemgrexMatcher;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.semgraph.SemanticGraphFactory;

public class SemgrexDemo  {
    public static void main(String[] args) {
        Tree someHowBuiltTree;//idnt know how to construct Tree from conll
        SemanticGraph graph = SemanticGraphFactory.generateUncollapsedDependencies(someHowBuiltTree);
        SemgrexPattern semgrex = SemgrexPattern.compile("{}=A <<nsubj {}=B");
        SemgrexMatcher matcher = semgrex.matcher(graph);
    }
}

実際、conll からツリーを構築する方法についていくつか提案が必要です。

4

1 に答える 1