예제 #1
0
        public virtual bool IsIncompatible(Mention m1, Mention m2)
        {
            int mid1 = System.Math.Min(m1.mentionID, m2.mentionID);
            int mid2 = System.Math.Max(m1.mentionID, m2.mentionID);

            return(incompatibles.Contains(mid1, mid2));
        }
 public virtual bool Test(Tree tree)
 {
     if (tree.IsLeaf() || tree.IsPreTerminal())
     {
         return(true);
     }
     if (tree.Children().Length == 0 || tree.Children().Length > 2)
     {
         throw new AssertionError("Tree not binarized");
     }
     if (tree.Children().Length == 1)
     {
         if (!unaryRules.Contains(tree.Children()[0].Label().Value()))
         {
             return(false);
         }
     }
     else
     {
         if (!binaryRules.Contains(tree.Children()[0].Label().Value(), tree.Children()[1].Label().Value()))
         {
             return(false);
         }
     }
     foreach (Tree child in tree.Children())
     {
         if (!Test(child))
         {
             return(false);
         }
     }
     return(true);
 }
예제 #3
0
        public virtual bool IsIncompatible(CorefCluster c1, CorefCluster c2)
        {
            // Was any of the pairs of mentions marked as incompatible
            int cid1 = System.Math.Min(c1.clusterID, c2.clusterID);
            int cid2 = System.Math.Max(c1.clusterID, c2.clusterID);

            return(incompatibleClusters.Contains(cid1, cid2));
        }