/** * Build a new list of connectors starting from the Tconnectors * in the list pointed to by e. Keep only those whose strings whose * direction has the value c. */ static Connector * extract_connectors(Tconnector *e, int c) { Connector *e1; if (e == NULL) return NULL; if (e->dir == c) { e1 = connector_new(); e1->next = extract_connectors(e->next,c); e1->multi = e->multi; e1->string = e->string; e1->word = 0; return e1; } else { return extract_connectors(e->next,c); } }
/** * Build a disjunct list out of the clause list c. * string is the print name of word that generated this disjunct. */ static Disjunct * build_disjunct(Clause * cl, const char * string, int cost_cutoff) { Disjunct *dis, *ndis; dis = NULL; for (; cl != NULL; cl = cl->next) { if (cl->maxcost <= cost_cutoff) { ndis = (Disjunct *) xalloc(sizeof(Disjunct)); ndis->left = reverse(extract_connectors(cl->c, '-')); ndis->right = reverse(extract_connectors(cl->c, '+')); ndis->string = string; ndis->cost = cl->cost; ndis->next = dis; dis = ndis; } } return dis; }
/** * Build a new list of connectors starting from the Tconnectors * in the list pointed to by e. Keep only those whose strings whose * direction has the value c. */ static Connector * extract_connectors(Tconnector *e, int c) { Connector *e1; if (e == NULL) return NULL; if (e->dir == c) { e1 = connector_new(); e1->next = extract_connectors(e->next,c); e1->multi = e->multi; e1->string = e->string; e1->label = NORMAL_LABEL; e1->priority = THIN_priority; e1->word = 0; return e1; } else { return extract_connectors(e->next,c); } }