List of usage examples for edu.stanford.nlp.trees Constituent end
public abstract int end();
From source file:ims.cs.lingdata.Token.java
License:Open Source License
/** * Determines whether a constituent starts at this token * @return/* w w w .j a v a2s . co m*/ */ public boolean hasStartingConstituents() { Tree tree = sentence.tree; Set<Constituent> constituents = tree.constituents(); for (Constituent c : constituents) { if (c.end() - c.start() > 1 && c.start() == predSentencePosition) return true; } return false; }
From source file:ims.cs.lingdata.Token.java
License:Open Source License
/** * Determines whether a constituent ends at this token * @return//w w w .j av a 2s . c o m */ public boolean hasEndingConstituents() { Tree tree = sentence.tree; Set<Constituent> constituents = tree.constituents(); for (Constituent c : constituents) { if (c.end() - c.start() > 1 && c.end() == predSentencePosition) return true; } return false; }
From source file:ims.cs.qsample.features.SpanFeatures.java
License:Open Source License
/** * Add features related to constituent matches of the span * @param span/* w w w . j a va 2 s .c o m*/ * @param fs */ public static void matchesConstituent(Span span, FeatureSet fs) { Sentence sentence = span.first().sentence; if (sentence != span.last().sentence) return; // CONSTITUENT SEQUENCE MATCH if (span.first().boundaryFeatureSet.contains("HAS-STARTING-CONSTITUENT") && span.last().boundaryFeatureSet.contains("HAS-ENDING-CONSTITUENT")) { fs.add("MATCHES-AT-LEAST-ONE-CONSTITUENT"); } // CONSTITUENT EXACT MATCH Set<Constituent> constituents = sentence.tree.constituents(); for (Constituent constituent : constituents) { int begin = constituent.start(); int end = constituent.end(); // TODO POST-ACL: end - begin > 0 would be correct. change later. if (end - begin > 1 && begin == span.first().predSentencePosition && end == span.last().predSentencePosition) { fs.add("MATCHES-CONSTITUENT"); } } }