link-grammar-5.8.0/link-grammar/parse/prune.c
/**
 * Validate that at least one disjunct of \p w may have no cross link.
 * FIXME maybe: Cache the checks for each word: Build an array indexed by
 * LHS nearest_word with values of the minimum RHS nearest_word of all the
 * disjuncts with this LHS nearest_word value or less than it. The size of
 * this array is ml[w].nw[1].
 **/
Validate that at least one disjunct of \p w may have no cross link.
FIXME maybe: Cache the checks for each word: Build an array indexed by
LHS nearest_word with values of the minimum RHS nearest_word of all the
disjuncts with this LHS nearest_word value or less than it. The size of
this array is ml[w].nw[1].
Validate that at least one disjunct of \ p w may have no cross link . FIXME maybe : Cache the checks for each word : Build an array indexed by LHS nearest_word with values of the minimum RHS nearest_word of all the disjuncts with this LHS nearest_word value or less than it . The size of this array is ml [ w ] . nw [ 1 ] .
static bool find_no_xlink_disjunct(prune_context *pc, int w,
                                   Connector *lc, Connector *rc,
                                   int lword, int rword)
{
	Sentence sent = pc->sent;
	Disjunct *d = sent->word[w].d;
	if ((pc->ml[w].nw[0]  == w) || (pc->ml[w].nw[1] == w)) return true;
	for (d = sent->word[w].d; d != NULL; d = d->next)
	{
		if (d->left->nearest_word < lword)
			continue;
		if (d->right->nearest_word > rword)
			continue;
		break;
	}
	if (d == NULL)
	{
		PR(N);
		return false;
	}
	return true;
}
static bool find_no_xlink_disjunct ( prune_context * pc , int w , Connector * lc , Connector * rc , int lword , int rword ) { Sentence sent = pc -> sent ; Disjunct * d = sent -> word [ w ] . d ; if ( ( pc -> ml [ w ] . nw [ 0 ] == w ) || ( pc -> ml [ w ] . nw [ 1 ] == w ) ) return true ; for ( d = sent -> word [ w ] . d ; d != NULL ; d = d -> next ) { if ( d -> left -> nearest_word < lword ) continue ; if ( d -> right -> nearest_word > rword ) continue ; break ; } if ( d == NULL ) { PR ( N ) ; return false ; } return true ; }
Validate that at least one disjunct of \p w may have no cross link.
Validate that at least one disjunct of \ p w may have no cross link .
/* One-direction disjuncts have already been validated.  */ /* More cross links can be detected here, but their resolution requires
	 * implementing backtracking in *_connector_list_update(). */