Example usage for opennlp.tools.parser Parse pruneParse

List of usage examples for opennlp.tools.parser Parse pruneParse

Introduction

In this page you can find the example usage for opennlp.tools.parser Parse pruneParse.

Prototype

public static void pruneParse(Parse parse) 

Source Link

Document

Prune the specified sentence parse of vacuous productions.

Usage

From source file:es.ehu.si.ixa.pipe.convert.Convert.java

/**
 * It takes as input a semi-pruned penn treebank tree (e.g., with -NONE-
 * traces removed) via sed 's/-NONE-\s[\*A-Za-z0-9]*[\*]*[\-]*[A-Za-z0-9]*'
 * /*w w w  .  j a v a2  s .  c  om*/
 * and prunes the empty trees remaining from the sed operation. The parseParse
 * function also removes function tags by default.
 * 
 * @param inputTrees
 * @return
 */
// TODO add the sed regexp to this function
private String normalizeParse(List<String> inputTrees) {
    StringBuilder parsedDoc = new StringBuilder();
    for (String parseSent : inputTrees) {
        Parse parse = Parse.parseParse(parseSent);
        Parse.pruneParse(parse);
        StringBuffer sentBuilder = new StringBuffer();
        parse.show(sentBuilder);
        parsedDoc.append(sentBuilder.toString()).append("\n");
    }
    return parsedDoc.toString();
}