mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-15 22:22:51 -06:00
added exprProbability
This commit is contained in:
@@ -439,6 +439,24 @@ PgfExpr pgf_read_expr_ex(PgfText *input, const char **end_pos, PgfUnmarshaller *
|
||||
return expr;
|
||||
}
|
||||
|
||||
PGF_API
|
||||
prob_t pgf_expr_prob(PgfDB *db, PgfRevision revision,
|
||||
PgfExpr e,
|
||||
PgfMarshaller *m,
|
||||
PgfExn *err)
|
||||
{
|
||||
PGF_API_BEGIN {
|
||||
DB_scope scope(db, READER_SCOPE);
|
||||
ref<PgfPGF> pgf = PgfDB::revision2pgf(revision);
|
||||
|
||||
PgfExprProbEstimator estimator(pgf, m);
|
||||
m->match_expr(&estimator, e);
|
||||
return estimator.get_prob();
|
||||
} PGF_API_END
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
PGF_API
|
||||
PgfText *pgf_print_type(PgfType ty,
|
||||
PgfPrintContext *ctxt, int prio,
|
||||
|
||||
Reference in New Issue
Block a user