diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2013-02-12 10:53:13 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2013-02-12 10:53:13 +0000 |
| commit | 4922ab6cc495087f40399746f616cd88590fd884 (patch) | |
| tree | b180f222f96c7e286337681efdc6834b94f6e3e8 /src/runtime/c/pgf/parser.c | |
| parent | a4c9d20fc3a92dc2e80208d4fe7b4f54a64a17af (diff) | |
now the beam size for the statistical parser can be configured by using the flag beam_size in the top-level concrete module
Diffstat (limited to 'src/runtime/c/pgf/parser.c')
| -rw-r--r-- | src/runtime/c/pgf/parser.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/runtime/c/pgf/parser.c b/src/runtime/c/pgf/parser.c index 6f02ed730..80de54ce8 100644 --- a/src/runtime/c/pgf/parser.c +++ b/src/runtime/c/pgf/parser.c @@ -1522,6 +1522,21 @@ pgf_parsing_proceed(PgfParseState* state) { return true; } +static prob_t +pgf_parsing_default_beam_size(PgfConcr* concr) +{ + GuPool* tmp_pool = gu_new_pool(); + PgfCId flag_name = gu_str_string("beam_size", tmp_pool); + PgfLiteral lit = gu_map_get(concr->cflags, &flag_name, PgfLiteral); + + if (gu_variant_is_null(lit)) + return 0; + + GuVariantInfo pi = gu_variant_open(lit); + gu_assert (pi.tag == PGF_LITERAL_FLT); + return ((PgfLiteralFlt*) pi.data)->val; +} + static PgfParsing* pgf_new_parsing(PgfConcr* concr, GuPool* pool) { @@ -1538,7 +1553,7 @@ pgf_new_parsing(PgfConcr* concr, GuPool* pool) ps->prod_full_count = 0; #endif ps->free_item = NULL; - ps->beam_size = 0.95; + ps->beam_size = pgf_parsing_default_beam_size(concr); PgfExprMeta *expr_meta = gu_new_variant(PGF_EXPR_META, |
