Package edu.stanford.nlp.semgraph

Examples of edu.stanford.nlp.semgraph.SemanticGraph.prettyPrint()


    String s =
        "(ROOT\n(S\n(NP (DT The) (NN chimney) (NNS sweeps))\n(VP (VBP do) (RB not)\n(VP (VB like)\n(S\n(VP (VBG working)\n(PP (IN on)\n(NP (DT an) (JJ empty) (NN stomach)))))))\n(. .)))";
    Tree tree = Tree.valueOf(s);
    SemanticGraph sg = SemanticGraphFactory.allTypedDependencies(tree, true);
    SemgrexPattern pat = SemgrexPattern.compile("{}=gov ![>det {}] & > {word:/^(?!not).*$/}=dep");
    sg.prettyPrint();
    // SemgrexPattern pat =
    // SemgrexPattern.compile("{} [[<prep_to ({word:married} >nsubjpass {})] | [<nsubjpass ({word:married} >prep_to {})]]");
    pat.prettyPrint();
    SemgrexMatcher mat = pat.matcher(sg);
    while (mat.find()) {
View Full Code Here


    SemgrexPattern pat3 = SemgrexPattern
        .compile("({word:/LIKE/}=parent >>/aux.*/ {word:/do/}=node)");
    System.out.println("pattern is ");
    pat3.prettyPrint();
    System.out.println("tree is ");
    sg.prettyPrint();

    //checking if ignoring case or not
    SemgrexMatcher mat3 = pat3.matcher(sg, true);
    if (mat3.find()) {
      String parent = mat3.getNode("parent").word();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.