src/Generic/UTCoref/LinkAllMentions.cpp
/* Given gold corefs, either:
 *  - write to out_file in a format suitable for yamcha to train an svm
 *  - give the maxentClassifier stuff to train on
 *
 * For each linkable node right_node we consider in reverse order all
 * previous linkable nodes left_node. Create negative examples until
 * we get to a pair that should be linked, then we create a single
 * positive example and stop. We attempt to generate a positive
 * example for the pairing that we think is most informative or
 * easiest to learn from:
 *  - pronouns link to their immediate (rightmost) antecedent
 *  - if the right node has a name and some antecedent also has a
 *     name, link to the rightmost named antecedent
 *  - otherwise link to the rightmost non-pronoun antecedent
 */
Given gold corefs, either:
- write to out_file in a format suitable for yamcha to train an svm
- give the maxentClassifier stuff to train on

For each linkable node right_node we consider in reverse order all
previous linkable nodes left_node. Create negative examples until
we get to a pair that should be linked, then we create a single
positive example and stop. We attempt to generate a positive
example for the pairing that we think is most informative or
easiest to learn from:
- pronouns link to their immediate (rightmost) antecedent
- if the right node has a name and some antecedent also has a
name, link to the rightmost named antecedent
- otherwise link to the rightmost non-pronoun antecedent
Given gold corefs either : - write to out_file in a format suitable for yamcha to train an svm - give the maxentClassifier stuff to train on For each linkable node right_node we consider in reverse order all previous linkable nodes left_node . Create negative examples until we get to a pair that should be linked then we create a single positive example and stop . We attempt to generate a positive example for the pairing that we think is most informative or easiest to learn from : - pronouns link to their immediate ( rightmost ) antecedent - if the right node has a name and some antecedent also has a name link to the rightmost named antecedent - otherwise link to the rightmost non - pronoun antecedent
void LinkAllMentions::create_examples(const UTCoref &corefs) {
   std::wstring feature_vec;
   bool are_linked;
   startTraining();
   for (int i = 0 ; i < linkable_nodes.length() ; i++) { 
	  const SynNode &right_node = *linkable_nodes[i];
	  for (int j = i-1 ; j >= 0 ; j--) { 
		 are_linked = corefs.areLinked(*linkable_nodes[j], right_node);
		 if (are_linked) {
			j = smartgen(i, j, corefs);
		 }
		 const SynNode &left_node = *linkable_nodes[j];
		 trainOnExample(left_node, right_node, are_linked);
		 if(are_linked) {
			break; 
		 }
	  }
   }
   classifier->finishTraining();
}
void LinkAllMentions :: create_examples ( const UTCoref & corefs ) { std :: wstring feature_vec ; bool are_linked ; startTraining ( ) ; for ( int i = 0 ; i < linkable_nodes . length ( ) ; i ++ ) { const SynNode & right_node = * linkable_nodes [ i ] ; for ( int j = i - 1 ; j >= 0 ; j -- ) { are_linked = corefs . areLinked ( * linkable_nodes [ j ] , right_node ) ; if ( are_linked ) { j = smartgen ( i , j , corefs ) ; } const SynNode & left_node = * linkable_nodes [ j ] ; trainOnExample ( left_node , right_node , are_linked ) ; if ( are_linked ) { break ; } } } classifier -> finishTraining ( ) ; }
Given gold corefs, either:
  - write to out_file in a format suitable for yamcha to train an svm
  - give the maxentClassifier stuff to train on
Given gold corefs either : - write to out_file in a format suitable for yamcha to train an svm - give the maxentClassifier stuff to train on
/*consider each node in the document */ /* consider each previous node */ /* go on to the next rightNode */