src/Generic/UTCoref/LinkAllMentions.cpp
/* i: right node's index into linkable_nodes
 * j: left node's index into linkable_node
 * returns: either j or some k less than j which refers to a node that
 * would be easier to learn from than j's
 * Details at create_examples */
right node's index into linkable_nodes
j: left node's index into linkable_node
returns: either j or some k less than j which refers to a node that
would be easier to learn from than j's
Details at create_examples
right node ' s index into linkable_nodes j : left node ' s index into linkable_node returns : either j or some k less than j which refers to a node that would be easier to learn from than j ' s Details at create_examples
int LinkAllMentions::smartgen(int i, int j, const UTCoref &corefs) const {
   if (isPronoun(*(linkable_nodes[i]))) { 
	  return j;
   }
   if (!getName(*linkable_nodes[i]).is_null()) {
	  for (int k = j ; k >= 0 ; k--) { 
		 if (corefs.areLinked(*linkable_nodes[k], *linkable_nodes[j])) { 
			if (!getName(*linkable_nodes[k]).is_null()) {
			   return k;
			}
		 }
	  }
   }
   for (int k = j ; k >= 0 ; k--) { 
	  if (corefs.areLinked(*linkable_nodes[k], *linkable_nodes[j])) { 
		 if (!isPronoun(*(linkable_nodes[k]))) { 
			return k;
		 }
	  }
   }
   return j; 
}
int LinkAllMentions :: smartgen ( int i , int j , const UTCoref & corefs ) const { if ( isPronoun ( * ( linkable_nodes [ i ] ) ) ) { return j ; } if ( ! getName ( * linkable_nodes [ i ] ) . is_null ( ) ) { for ( int k = j ; k >= 0 ; k -- ) { if ( corefs . areLinked ( * linkable_nodes [ k ] , * linkable_nodes [ j ] ) ) { if ( ! getName ( * linkable_nodes [ k ] ) . is_null ( ) ) { return k ; } } } } for ( int k = j ; k >= 0 ; k -- ) { if ( corefs . areLinked ( * linkable_nodes [ k ] , * linkable_nodes [ j ] ) ) { if ( ! isPronoun ( * ( linkable_nodes [ k ] ) ) ) { return k ; } } } return j ; }
i: right node's index into linkable_nodes
 j: left node's index into linkable_node
 returns: either j or some k less than j which refers to a node that
 would be easier to learn from than j's
 Details at create_examples
i : right node ' s index into linkable_nodes j : left node ' s index into linkable_node returns : either j or some k less than j which refers to a node that would be easier to learn from than j ' s Details at create_examples
/* pronouns link to the most recent antecedent */ /* consider previous nodes */ /* consider nodes in this chain */ /* consider previous nodes */ /* consider nodes in this chain */ /* no pronouns */ /* no node is better than the j we started with */