1
0
forked from GitHub/gf-core

revised heuristic in the statistical parser

This commit is contained in:
kr.angelov
2012-11-14 12:34:22 +00:00
parent 7a69d9d5e5
commit a3ba1991f4

View File

@@ -90,7 +90,7 @@ struct PgfParseState {
unsigned short offset; unsigned short offset;
#endif #endif
prob_t delta_prob; prob_t viterbi_prob;
PgfParsing* ps; PgfParsing* ps;
PgfTokenState* ts; PgfTokenState* ts;
@@ -743,9 +743,8 @@ pgf_parsing_add_transition(PgfParseState* before, PgfParseState* after,
if (gu_string_eq(tok, after->ts->tok)) { if (gu_string_eq(tok, after->ts->tok)) {
if (after->next == NULL) { if (after->next == NULL) {
after->ps->target = item; after->ps->target = item;
after->delta_prob = after->viterbi_prob =
item->inside_prob+item->conts->outside_prob - item->inside_prob+item->conts->outside_prob;
before->delta_prob;
} }
gu_buf_heap_push(after->agenda, &pgf_item_prob_order, &item); gu_buf_heap_push(after->agenda, &pgf_item_prob_order, &item);
@@ -1552,7 +1551,8 @@ pgf_parsing_proceed(PgfParseState* state) {
} }
} }
delta_prob += st->delta_prob*0.8; delta_prob +=
(st->viterbi_prob-(st->next ? st->next->viterbi_prob : 0))*0.95;
st = st->next; st = st->next;
} }
@@ -1634,7 +1634,7 @@ pgf_new_parse_state(PgfParsing* ps,
#ifdef PGF_PARSER_DEBUG #ifdef PGF_PARSER_DEBUG
state->offset = next ? next->offset+1 : 0; state->offset = next ? next->offset+1 : 0;
#endif #endif
state->delta_prob = 0; state->viterbi_prob = 0;
state->ps = ps; state->ps = ps;
state->ts = ts; state->ts = ts;
return state; return state;