@Override public String toString() { return toString(CoreLabel.OutputFormat.VALUE_INDEX); }
public void handleDependencies(String arg, OutputStream outStream, String commandArgs) throws IOException { Tree tree = parse(arg, false); if (tree == null) { return; } // TODO: this might throw an exception if the parser doesn't support dependencies. Handle that cleaner? GrammaticalStructure gs = parser.getTLPParams().getGrammaticalStructure(tree, parser.treebankLanguagePack().punctuationWordRejectFilter(), parser.getTLPParams().typedDependencyHeadFinder()); Collection<TypedDependency> deps = null; switch (commandArgs.toUpperCase()) { case "COLLAPSED_TREE": deps = gs.typedDependenciesCollapsedTree(); break; default: throw new UnsupportedOperationException("Dependencies type not implemented: " + commandArgs); } OutputStreamWriter osw = new OutputStreamWriter(outStream, "utf-8"); for (TypedDependency dep : deps) { osw.write(dep.toString()); osw.write("\n"); } osw.flush(); }
String item = tdl.toString(); dependencies.add(item); LOG.info("\t" + item);
@Override public String toString() { return toString(CoreLabel.OutputFormat.VALUE_INDEX); }
@Override public String toString() { return toString(CoreLabel.OutputFormat.VALUE_INDEX); }
public String toString(boolean noIndex) { if (!noIndex) return toString(); String govWord = gov.toString(); String depWord = dep.toString(); govWord = govWord.substring(0,govWord.lastIndexOf("-")); depWord = depWord.substring(0,depWord.lastIndexOf("-")); return reln + "(" + govWord + ", " + depWord + ")"; }
public String toString(boolean noIndex) { if (!noIndex) return toString(); String govWord = gov.toString(); String depWord = dep.toString(); govWord = govWord.substring(0,govWord.lastIndexOf("-")); depWord = depWord.substring(0,depWord.lastIndexOf("-")); return reln + "(" + govWord + ", " + depWord + ")"; }
public void handleDependencies(String arg, OutputStream outStream, String commandArgs) throws IOException { Tree tree = parse(arg, false); if (tree == null) { return; } // TODO: this might throw an exception if the parser doesn't support dependencies. Handle that cleaner? GrammaticalStructure gs = parser.getTLPParams().getGrammaticalStructure(tree, parser.treebankLanguagePack().punctuationWordRejectFilter(), parser.getTLPParams().typedDependencyHeadFinder()); Collection<TypedDependency> deps = null; switch (commandArgs.toUpperCase()) { case "COLLAPSED_TREE": deps = gs.typedDependenciesCollapsedTree(); break; default: throw new UnsupportedOperationException("Dependencies type not implemented: " + commandArgs); } OutputStreamWriter osw = new OutputStreamWriter(outStream, "utf-8"); for (TypedDependency dep : deps) { osw.write(dep.toString()); osw.write("\n"); } osw.flush(); }
public void handleDependencies(String arg, OutputStream outStream, String commandArgs) throws IOException { Tree tree = parse(arg, false); if (tree == null) { return; } // TODO: this might throw an exception if the parser doesn't support dependencies. Handle that cleaner? GrammaticalStructure gs = parser.getTLPParams().getGrammaticalStructure(tree, parser.treebankLanguagePack().punctuationWordRejectFilter(), parser.getTLPParams().typedDependencyHeadFinder()); Collection<TypedDependency> deps = null; switch (commandArgs.toUpperCase()) { case "COLLAPSED_TREE": deps = gs.typedDependenciesCollapsedTree(); break; default: throw new UnsupportedOperationException("Dependencies type not implemented: " + commandArgs); } OutputStreamWriter osw = new OutputStreamWriter(outStream, "utf-8"); for (TypedDependency dep : deps) { osw.write(dep.toString()); osw.write("\n"); } osw.flush(); }