link-grammar-5.8.0/link-grammar/parse/prune.c
/**
 * For selector \p s with a wildcard, validate that no connector in the
 * sentence that matches the candidate trigger connector \p t may create a
 * link x so that post_process_match(s, x)==false.
 *
 * If so, this ensures that the candidate trigger connector may form
 * only links which satisfy the selector. (This bypasses the limitation
 * on selectors with '*' that is mentioned in the original comments).
 *
 * The algo validates that the '*'s in the selector \p s and in an each
 * easy_matched()'ed sentence connector (both '*' padded as needed) are at
 * the same places.
 *
 * @param s A selector which includes a dictionary wildcard ('*').
 * @param t Candidate trigger connector.
 * @param cmt The cms table (sentence connectors)
 * @return \c true iff such a link cannot be formed.
 */
For selector \p s with a wildcard, validate that no connector in the
sentence that matches the candidate trigger connector \p t may create a
link x so that post_process_match(s, x)==false.

If so, this ensures that the candidate trigger connector may form
only links which satisfy the selector. (This bypasses the limitation
on selectors with '*' that is mentioned in the original comments).



@param s A selector which includes a dictionary wildcard ('*').
@param t Candidate trigger connector.
@param cmt The cms table (sentence connectors)
@return \c true iff such a link cannot be formed.
For selector \ p s with a wildcard validate that no connector in the sentence that matches the candidate trigger connector \ p t may create a link x so that post_process_match ( s x ) == false . If so this ensures that the candidate trigger connector may form only links which satisfy the selector . ( This bypasses the limitation on selectors with ' * ' that is mentioned in the original comments ) . @param s A selector which includes a dictionary wildcard ( ' * ' ) . @param t Candidate trigger connector . @param cmt The cms table ( sentence connectors ) @return \ c true iff such a link cannot be formed .
static bool selector_mismatch_wild(multiset_table *cmt, const char *s,
                                   Cms *cms_t)
{
	unsigned int h = cms_hash(s);
	ppdebug("Selector %s, trigger %s\n", s, connector_string(cms_t->c));
	for (Cms *cms = cmt->cms_table[h]; cms != NULL; cms = cms->next)
	{
		if ((cms_t->left && !cms->right) || (cms_t->right && !cms->left))
		    continue;
		size_t len_s = strlen(s);
		if (easy_match_desc(cms_t->c->desc, cms->c->desc))
		{
			const char *c = connector_string(cms->c);
			size_t len_c = strlen(c);
			for (size_t i = 0; i < len_s; i++)
			{
				if ((s[i] == '*') && ((i < len_c) && c[i] != '*'))
				{
					ppdebug("MISMATCH: %s\n", c);
					return true;
				}
			}
			ppdebug("MATCH: %s\n", c);
		}
	}
	return false;
}
static bool selector_mismatch_wild ( multiset_table * cmt , const char * s , Cms * cms_t ) { unsigned int h = cms_hash ( s ) ; ppdebug ( " \n " , s , connector_string ( cms_t -> c ) ) ; for ( Cms * cms = cmt -> cms_table [ h ] ; cms != NULL ; cms = cms -> next ) { if ( ( cms_t -> left && ! cms -> right ) || ( cms_t -> right && ! cms -> left ) ) continue ; size_t len_s = strlen ( s ) ; if ( easy_match_desc ( cms_t -> c -> desc , cms -> c -> desc ) ) { const char * c = connector_string ( cms -> c ) ; size_t len_c = strlen ( c ) ; for ( size_t i = 0 ; i < len_s ; i ++ ) { if ( ( s [ i ] == ' ' ) && ( ( i < len_c ) && c [ i ] != ' ' ) ) { ppdebug ( " \n " , c ) ; return true ; } } ppdebug ( " \n " , c ) ; } } return false ; }
For selector \p s with a wildcard, validate that no connector in the
 sentence that matches the candidate trigger connector \p t may create a
 link x so that post_process_match(s, x)==false.
For selector \ p s with a wildcard validate that no connector in the sentence that matches the candidate trigger connector \ p t may create a link x so that post_process_match ( s x ) == false .