Example #1
0
 /**
  * Returns <code>true</code> if <code>preterminal</code> represents a terminal with one of the
  * following parts of speech: <tt>VB, VBD, VBG, VBN, VBP</tt> or <tt>VBZ</tt>. It is an error to
  * call this method with a <code>Sexp</code> object for which {@link #isPreterminal(Sexp)} returns
  * <code>false</code>.<br>
  *
  * @param preterminal the preterminal to test
  * @return <code>true</code> if <code>preterminal</code> is a verb
  */
 public boolean isVerb(Sexp preterminal) {
   return isVerbTag(preterminal.list().get(0).symbol());
 }
Example #2
0
 /**
  * Returns <code>true</code> if the specified S-expression represents a preterminal that is the
  * possessive part of speech. This method is intended to be used by implementations of {@link
  * Training#addBaseNPs(Sexp)}.
  */
 public boolean isPossessivePreterminal(Sexp tree) {
   return (isPreterminal(tree) && tree.list().get(0).symbol() == possessivePos);
 }
Example #3
0
 /**
  * Returns <code>true</code> if the specified S-expression represents a preterminal whose terminal
  * element is the null element (<code>&quot;-NONE-&quot;</code>) for the Penn Treebank.
  *
  * @see Training#relabelSubjectlessSentences(Sexp)
  */
 public boolean isNullElementPreterminal(Sexp tree) {
   return (isPreterminal(tree) && tree.list().get(0).symbol() == nullElementPreterminal);
 }
Example #4
0
 /**
  * Returns <code>true</code> if the specified S-expression is a preterminal whose part of speech
  * is <code>&quot;,&quot;</code> or <code>&quot;:&quot;</code>.
  */
 public boolean isPuncToRaise(Sexp preterm) {
   return (isPreterminal(preterm) && puncToRaise.contains(preterm.list().first()));
 }
Example #5
0
 /**
  * Returns <code>true</code> if <code>tree</code> represents a preterminal subtree (part-of-speech
  * tag and word). Specifically, this method returns <code>true</code> if <code>tree</code> is an
  * instance of <code>SexpList</code>, has a length of 2 and has a first list element of type
  * <code>Symbol</code>.
  */
 public final boolean isPreterminal(Sexp tree) {
   return (tree.isList()
       && tree.list().length() == 2
       && tree.list().get(0).isSymbol()
       && tree.list().get(1).isSymbol());
 }