コード例 #1
0
ファイル: prune.c プロジェクト: ampli/link-grammar
/**
 * Do the following pruning steps until nothing happens:
 * power pp power pp power pp....
 * Make sure you do them both at least once.
 */
void pp_and_power_prune(Sentence sent, Parse_Options opts)
{
	power_prune(sent, opts);
	pp_prune(sent, opts);

	return;

	// Not reached. We can actually gain a few percent of
	// performance be skipping the loop below. Mostly, it just
	// does a lot of work, and pretty much finds nothing.
	// And so we skip it.
#ifdef ONLY_IF_YOU_THINK_THIS_IS_WORTH_IT
	for (;;) {
		if (pp_prune(sent, opts) == 0) break;
		if (power_prune(sent, opts) == 0) break;
	}
#endif
}
コード例 #2
0
ファイル: prune.c プロジェクト: linas/link-grammar
/**
 * Prune useless disjuncts.
 */
void pp_and_power_prune(Sentence sent, Parse_Options opts)
{
	power_table pt;
	power_table_alloc(sent, &pt);
	power_table_init(sent, &pt);

	power_prune(sent, opts, &pt);
	if (pp_prune(sent, opts) > 0)
		power_prune(sent, opts, &pt);

	/* No benefit for now to make additional pp_prune() & power_prune() -
	 * additional deletions are very rare and even then most of the
	 * times only one disjunct is deleted. */

	power_table_delete(&pt);

	return;
}