link-grammar-5.8.0/link-grammar/dict-common/print-dict.c
/**
 * Count the number of clauses (disjuncts) for the expression e.
 * Should return the number of disjuncts that would be returned
 * by build_disjunct().  This in turn should be equal to the number
 * of clauses built by build_clause().
 *
 * Only one minor cheat here: we are ignoring the cost_cutoff, so
 * this potentially over-counts if the cost_cutoff is set low.
 */
Count the number of clauses (disjuncts) for the expression e.
Should return the number of disjuncts that would be returned
by build_disjunct().  This in turn should be equal to the number
of clauses built by build_clause().

Only one minor cheat here: we are ignoring the cost_cutoff, so
this potentially over-counts if the cost_cutoff is set low.
Count the number of clauses ( disjuncts ) for the expression e . Should return the number of disjuncts that would be returned by build_disjunct () . This in turn should be equal to the number of clauses built by build_clause () . Only one minor cheat here : we are ignoring the cost_cutoff so this potentially over - counts if the cost_cutoff is set low .
static unsigned int count_clause(Exp *e)
{
	unsigned int cnt = 0;
	assert(e != NULL, "count_clause called with null parameter");
	if (e->type == AND_type)
	{
		cnt = 1;
		for (Exp *opd = e->operand_first; opd != NULL; opd = opd->operand_next)
			cnt *= count_clause(opd);
	}
	else if (e->type == OR_type)
	{
		for (Exp *opd = e->operand_first; opd != NULL; opd = opd->operand_next)
			cnt += count_clause(opd);
	}
	else if (e->type == CONNECTOR_type)
	{
		return 1;
	}
	else
	{
		assert(false, "Unknown expression type %d", (int)e->type);
	}
	return cnt;
}
static unsigned int count_clause ( Exp * e ) { unsigned int cnt = 0 ; assert ( e != NULL , " " ) ; if ( e -> type == AND_type ) { cnt = 1 ; for ( Exp * opd = e -> operand_first ; opd != NULL ; opd = opd -> operand_next ) cnt *= count_clause ( opd ) ; } else if ( e -> type == OR_type ) { for ( Exp * opd = e -> operand_first ; opd != NULL ; opd = opd -> operand_next ) cnt += count_clause ( opd ) ; } else if ( e -> type == CONNECTOR_type ) { return 1 ; } else { assert ( false , " " , ( int ) e -> type ) ; } return cnt ; }
Count the number of clauses (disjuncts) for the expression e.
 Should return the number of disjuncts that would be returned
 by build_disjunct().
Count the number of clauses ( disjuncts ) for the expression e . Should return the number of disjuncts that would be returned by build_disjunct () .
/* multiplicative combinatorial explosion */ /* Just additive */