/// <summary>
 /// Transforms t if it contains an UCP, it will change the UCP tag
 /// into the phrasal tag of the first word of the UCP
 /// (UCP (JJ electronic) (, ,) (NN computer) (CC and) (NN building))
 /// will become
 /// (ADJP (JJ electronic) (, ,) (NN computer) (CC and) (NN building))
 /// </summary>
 /// <param name="t">a tree to be transformed</param>
 /// <returns>t transformed</returns>
 public static Tree UcpTransform(Tree t)
 {
     if (t == null)
     {
         return(null);
     }
     return(Tsurgeon.ProcessPattern(UcpRenameTregex, UcpRenameTsurgeon, t));
 }
 private static Tree RearrangeNowThat(Tree t)
 {
     if (t == null)
     {
         return(t);
     }
     return(Tsurgeon.ProcessPattern(RearrangeNowThatTregex, RearrangeNowThatTsurgeon, t));
 }
 private static Tree CombineConjp(Tree t)
 {
     if (t == null)
     {
         return(null);
     }
     return(Tsurgeon.ProcessPattern(FindFlatConjpTregex, AddConjpTsurgeon, t));
 }
 /// <summary>
 /// For certain phrases, we change the SBAR to a PP to get prep/pcomp
 /// dependencies.  For example, in "The day after the airline was
 /// planning...", we want prep(day, after) and pcomp(after,
 /// planning).  If "after the airline was planning" was parsed as an
 /// SBAR, either by the parser or in the treebank, we fix that here.
 /// </summary>
 private static Tree ChangeSbarToPp(Tree t)
 {
     if (t == null)
     {
         return(null);
     }
     return(Tsurgeon.ProcessPattern(ChangeSbarToPpTregex, ChangeSbarToPpTsurgeon, t));
 }
Пример #5
0
 /// <summary>
 /// Transforms t if it contains one of the following QP structure:
 /// <ul>
 /// <li> NP (QP ...) (QP (CC and/or) ...)</li>
 /// <li> QP (RB IN CD|DT ...)   well over, more than</li>
 /// <li> QP (JJR IN CD|DT ...)  fewer than</li>
 /// <li> QP (IN JJS CD|DT ...)  at least</li>
 /// <li> QP (... CC ...)        between 5 and 10</li>
 /// </ul>
 /// </summary>
 /// <param name="t">a tree to be transformed</param>
 /// <returns>t transformed</returns>
 public static Tree QpTransform(Tree t)
 {
     t = Tsurgeon.ProcessPattern(FlattenNpOverQpTregex, FlattenNpOverQpTsurgeon, t);
     t = Tsurgeon.ProcessPattern(MultiwordXsTregex, MultiwordXsTsurgeon, t);
     t = Tsurgeon.ProcessPattern(SplitCcTregex, SplitCcTsurgeon, t);
     t = Tsurgeon.ProcessPattern(SplitMoneyTregex, SplitMoneyTsurgeon, t);
     return(t);
 }
 private static Tree MoveRb(Tree t)
 {
     if (t == null)
     {
         return(null);
     }
     foreach (TregexPattern pattern in MoveRbTregex)
     {
         t = Tsurgeon.ProcessPattern(pattern, MoveRbTsurgeon, t);
     }
     return(t);
 }
 /// <summary>
 /// Removes the SQ structure under a WHNP question, such as "Who am I
 /// to judge?".  We do this so that it is easier to pick out the head
 /// and then easier to connect that head to all of the other words in
 /// the question in this situation.  In the specific case of making
 /// the copula head, we don't do this so that the existing headfinder
 /// code can easily find the "am" or other copula verb.
 /// </summary>
 public Tree SqFlatten(Tree t)
 {
     if (headFinder != null && (headFinder is ICopulaHeadFinder))
     {
         if (((ICopulaHeadFinder)headFinder).MakesCopulaHead())
         {
             return(t);
         }
     }
     if (t == null)
     {
         return(null);
     }
     return(Tsurgeon.ProcessPattern(FlattenSqTregex, FlattenSqTsurgeon, t));
 }
 public static Tree RemoveXOverX(Tree t)
 {
     return(Tsurgeon.ProcessPattern(RemoveXOverXTregex, RemoveXOverXTsurgeon, t));
 }
Пример #9
0
 protected static Tree StripEmptyNode(Tree t)
 {
     return(Tsurgeon.ProcessPattern(MatchPattern, Operation, t));
 }