link-grammar-5.8.0/link-grammar/api.c
/***************************************************************
*
* Routines for creating destroying and processing Sentences
*
****************************************************************/
Routines for creating destroying and processing Sentences
Routines for creating destroying and processing Sentences
Sentence sentence_create(const char *input_string, Dictionary dict)
{
	Sentence sent;
	sent = (Sentence) malloc(sizeof(struct Sentence_s));
	memset(sent, 0, sizeof(struct Sentence_s));
	sent->dict = dict;
	sent->string_set = string_set_create();
	sent->rand_state = global_rand_state;
	sent->Exp_pool = pool_new(__func__, "Exp", 4096,
	                             sizeof(Exp), false,
	                             false, false);
	sent->X_node_pool = pool_new(__func__, "X_node", 256,
	                             sizeof(X_node), false,
	                             false, false);
	sent->postprocessor = post_process_new(dict->base_knowledge);
	sent->orig_sentence = string_set_add (input_string, sent->string_set);
	sent->min_len_encoding = SENTENCE_MIN_LENGTH_TRAILING_HASH;
	const char *min_len_encoding = test_enabled("min-len-encoding");
	if (NULL != min_len_encoding)
		sent->min_len_encoding = atoi(min_len_encoding+1);
	sent->min_len_multi_pruning = SENTENCE_MIN_LENGTH_MULTI_PRUNING;
	const char *min_len_multi_pruning = test_enabled("len-multi-pruning");
	if (NULL != min_len_multi_pruning)
		sent->min_len_multi_pruning = atoi(min_len_multi_pruning+1);
	return sent;
}
Sentence sentence_create ( const char * input_string , Dictionary dict ) { Sentence sent ; sent = ( Sentence ) malloc ( sizeof ( struct Sentence_s ) ) ; memset ( sent , 0 , sizeof ( struct Sentence_s ) ) ; sent -> dict = dict ; sent -> string_set = string_set_create ( ) ; sent -> rand_state = global_rand_state ; sent -> Exp_pool = pool_new ( __func__ , " " , 4096 , sizeof ( Exp ) , false , false , false ) ; sent -> X_node_pool = pool_new ( __func__ , " " , 256 , sizeof ( X_node ) , false , false , false ) ; sent -> postprocessor = post_process_new ( dict -> base_knowledge ) ; sent -> orig_sentence = string_set_add ( input_string , sent -> string_set ) ; sent -> min_len_encoding = SENTENCE_MIN_LENGTH_TRAILING_HASH ; const char * min_len_encoding = test_enabled ( " " ) ; if ( NULL != min_len_encoding ) sent -> min_len_encoding = atoi ( min_len_encoding + 1 ) ; sent -> min_len_multi_pruning = SENTENCE_MIN_LENGTH_MULTI_PRUNING ; const char * min_len_multi_pruning = test_enabled ( " " ) ; if ( NULL != min_len_multi_pruning ) sent -> min_len_multi_pruning = atoi ( min_len_multi_pruning + 1 ) ; return sent ; }
Routines for creating destroying and processing Sentences
Routines for creating destroying and processing Sentences
/*num_elements*/ /*zero_out*/ /*align*/ /*exact*/ /*num_elements*/ /*zero_out*/ /*align*/ /*exact*/ /* Make a copy of the input */ /* Set the minimum length for tracon sharing.
	 * In that case a tracon list is produced for the pruning step,
	 * and disjunct/connector packing is done too. */ /* Set the minimum length for pruning per null-count. */