Exemplo n.º 1
0
/**
 * Create and initialize a Parse_Options object
 */
Parse_Options parse_options_create(void)
{
	Parse_Options po;

	init_memusage();
	po = (Parse_Options) malloc(sizeof(struct Parse_Options_s));

	/* Here's where the values are initialized */

	/* The parse_options_set_(verbosity|debug|test) functions set also the
	 * corresponding global variables. So these globals are initialized
	 * here too. */
	verbosity = po->verbosity = 1;
	debug = po->debug = (char *)"";
	test = po->test = (char *)"";

	/* A cost of 2.7 allows the usual cost-2 connectors, plus the
	 * assorted fractional costs, without going to cost 3.0, which
	 * is used only during panic-parsing.
	 * XXX In the long run, this should be fetched from the dictionary
	 * (and should probably not be a parse option).
	 */
	po->disjunct_cost = 2.7;
	po->min_null_count = 0;
	po->max_null_count = 0;
	po->islands_ok = false;
	po->use_sat_solver = false;
	po->use_viterbi = false;
	po->linkage_limit = 100;
#if defined HAVE_HUNSPELL || defined HAVE_ASPELL
	po->use_spell_guess = 7;
#else
	po->use_spell_guess = 0;
#endif /* defined HAVE_HUNSPELL || defined HAVE_ASPELL */

#ifdef XXX_USE_CORPUS
	/* Use the corpus cost model, if available.
	 * It really does a better job at parse ranking.
	 * Err .. sometimes ...
	 */
	po->cost_model.compare_fn = &CORP_compare_parse;
	po->cost_model.type = CORPUS;
#else /* USE_CORPUS */
	po->cost_model.compare_fn = &VDAL_compare_parse;
	po->cost_model.type = VDAL;
#endif /* USE_CORPUS */
	po->short_length = 16;
	po->all_short = false;
	po->perform_pp_prune = true;
	po->twopass_length = 30;
	po->repeatable_rand = true;
	po->resources = resources_create();
	po->use_cluster_disjuncts = false;
	po->display_morphology = false;

	return po;
}
Exemplo n.º 2
0
/**
 * Create and initialize a Parse_Options object
 */
Parse_Options parse_options_create(void)
{
	Parse_Options po;

	init_memusage();
	po = (Parse_Options) xalloc(sizeof(struct Parse_Options_s));

	/* Here's where the values are initialized */
	po->verbosity = 1;
	po->debug = (char *)"";
	po->test = (char *)"";
	po->linkage_limit = 100;

	/* A cost of 2.7 allows the usual cost-2 connectors, plus the
	 * assorted fractional costs, without going to cost 3.0, which
	 * is used only during panic-parsing.
	 */
	po->disjunct_cost = 2.7; /* 3.0 is needed for Russian dicts */
	po->min_null_count = 0;
	po->max_null_count = 0;
	po->islands_ok = false;
	po->use_spell_guess = 7;
	po->use_sat_solver = false;
	po->use_viterbi = false;

#ifdef XXX_USE_CORPUS
	/* Use the corpus cost model, if available.
	 * It really does a better job at parse ranking.
	 * Err .. sometimes ...
	 */
	po->cost_model.compare_fn = &CORP_compare_parse;
	po->cost_model.type = CORPUS;
#else /* USE_CORPUS */
	po->cost_model.compare_fn = &VDAL_compare_parse;
	po->cost_model.type = VDAL;
#endif /* USE_CORPUS */
	po->short_length = 16;
	po->all_short = false;
	po->twopass_length = 30;
	po->repeatable_rand = true;
	po->resources = resources_create();
	po->use_cluster_disjuncts = false;
	po->display_morphology = false;

	return po;
}
Exemplo n.º 3
0
static void assembly_create(xmlNode *cur_node)
{
	struct assembly *assembly;
	char *name;
	char *uuid;
	xmlNode *child_node;
	char *escalation_failures;
	char *escalation_period;

	qb_enter();

	assembly = calloc(1, sizeof (struct assembly));
	name = (char*)xmlGetProp(cur_node, BAD_CAST "name");
	assembly->name = strdup(name);
	uuid = (char*)xmlGetProp(cur_node, BAD_CAST "uuid");
	assembly->uuid = strdup(uuid);
	assembly->resource_map = qb_skiplist_create();
	assembly->sw_instance_create = qb_util_stopwatch_create();
	assembly->sw_instance_connected = qb_util_stopwatch_create();
	assembly->application = application;

	escalation_failures = (char*)xmlGetProp(cur_node, BAD_CAST "escalation_failures");
	escalation_period = (char*)xmlGetProp(cur_node, BAD_CAST "escalation_period");

	recover_init(&assembly->recover,
		    escalation_failures, escalation_period,
		    node_recover_restart,
		    node_recover_escalate,
		    node_state_change_event);
	assembly->recover.instance = assembly;

	instance_create(assembly);
	qb_map_put(assembly_map, name, assembly);

	for (child_node = cur_node->children; child_node;
		child_node = child_node->next) {
		if (child_node->type != XML_ELEMENT_NODE) {
			continue;
		}
		if (strcmp((char*)child_node->name, "services") == 0) {
			resources_create(child_node->children, assembly);
		}
	}

	qb_leave();
}
Exemplo n.º 4
0
Arquivo: api.c Projeto: mclumd/Alfred
Parse_Options parse_options_create() {
  /* create and initialize a Parse_Options object */
    Parse_Options po;

    po = (Parse_Options) xalloc(sizeof(struct Parse_Options_s));

    /* Here's where the values are initialized */
    po->verbosity     = 0; /*Darsana changed from 1 - aug 2 2003*/
    po->linkage_limit = 100;
    po->disjunct_cost = MAX_DISJUNCT_COST;
    po->min_null_count = 0;
    po->max_null_count = 0;
    po->null_block = 1;
    po->islands_ok = FALSE;
    po->cost_model.compare_fn = &VDAL_compare_parse;
    po->cost_model.type       = VDAL;
    po->short_length = 6;
    po->all_short = FALSE;
    po->twopass_length = 30;
    po->max_sentence_length = 70;
    po->resources = resources_create();
    po->display_short = TRUE;
    po->display_word_subscripts = TRUE;
    po->display_link_subscripts = TRUE;
    po->display_walls = FALSE;
    po->display_union = FALSE;
    po->allow_null = TRUE;
    po->echo_on = FALSE;
    po->batch_mode = FALSE;
    po->panic_mode = FALSE;
    po->screen_width = 79;
    po->display_on = TRUE;
    po->display_postscript = FALSE;
    po->display_constituents = TRUE;
    po->display_bad = FALSE;
    po->display_links = FALSE;

    return po;
}