List of usage examples for edu.stanford.nlp.semgraph SemanticGraph SemanticGraph
public SemanticGraph()
From source file:edu.jhu.hlt.concrete.stanford.ConcreteStanfordPreCorefAnalytic.java
License:Open Source License
/** * sentences with no dependency structure have null values for the various dependency annotations. make sure these are empty dependencies instead to prevent * coref-resolution from dying/*from w ww .j a va2 s.com*/ */ private static void fixNullDependencyGraphs(Annotation anno) { for (CoreMap sent : anno.get(SentencesAnnotation.class)) { if (sent.get(CollapsedDependenciesAnnotation.class) == null) { sent.set(CollapsedDependenciesAnnotation.class, new SemanticGraph()); } } }
From source file:opendial.bn.values.RelationalVal.java
License:Open Source License
public RelationalVal() { graph = new SemanticGraph(); }
From source file:opendial.bn.values.RelationalVal.java
License:Open Source License
public RelationalVal(String string) { this.graph = new SemanticGraph(); StringBuilder current = new StringBuilder(); int openedBrackets = 0; recordRelations(string);/*from www . j a v a 2 s . com*/ for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); if (openedBrackets == 0 && !current.toString().trim().isEmpty() && (c == ' ' || c == '[' || i == string.length() - 1)) { addGraph(SemanticGraph.valueOf(current.toString())); current = new StringBuilder(); } current.append(c); if (c == '[') { openedBrackets++; } else if (c == ']') { openedBrackets--; if (openedBrackets == 0 && current.length() > 2) { addGraph(SemanticGraph.valueOf(current.toString())); current = new StringBuilder(); } } } }