diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2012-11-14 12:34:22 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2012-11-14 12:34:22 +0000 |
| commit | 5c52eaf0b71fce381d363edca776ac07269f0a69 (patch) | |
| tree | 389282ff0111ab1775f4dfce2fad9ad47a27d3f1 /src/runtime/c/pgf/parser.c | |
| parent | 5c8c1f768fae242ba659d4b6a3696336042e0b1c (diff) | |
revised heuristic in the statistical parser
Diffstat (limited to 'src/runtime/c/pgf/parser.c')
| -rw-r--r-- | src/runtime/c/pgf/parser.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/runtime/c/pgf/parser.c b/src/runtime/c/pgf/parser.c index bdfce1ef9..5c62e3977 100644 --- a/src/runtime/c/pgf/parser.c +++ b/src/runtime/c/pgf/parser.c @@ -90,7 +90,7 @@ struct PgfParseState { unsigned short offset; #endif - prob_t delta_prob; + prob_t viterbi_prob; PgfParsing* ps; PgfTokenState* ts; @@ -743,9 +743,8 @@ pgf_parsing_add_transition(PgfParseState* before, PgfParseState* after, if (gu_string_eq(tok, after->ts->tok)) { if (after->next == NULL) { after->ps->target = item; - after->delta_prob = - item->inside_prob+item->conts->outside_prob - - before->delta_prob; + after->viterbi_prob = + item->inside_prob+item->conts->outside_prob; } 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; } @@ -1634,7 +1634,7 @@ pgf_new_parse_state(PgfParsing* ps, #ifdef PGF_PARSER_DEBUG state->offset = next ? next->offset+1 : 0; #endif - state->delta_prob = 0; + state->viterbi_prob = 0; state->ps = ps; state->ts = ts; return state; |
