From 80a96b3a851c9af7635e31a95dc0d6edaa386051 Mon Sep 17 00:00:00 2001 From: krasimir Date: Tue, 10 May 2016 17:11:39 +0000 Subject: an API for oracles in the GF parser --- src/runtime/c/pgf/pgf.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/runtime/c/pgf/pgf.h') diff --git a/src/runtime/c/pgf/pgf.h b/src/runtime/c/pgf/pgf.h index 80cbe29f2..4a6199c6f 100644 --- a/src/runtime/c/pgf/pgf.h +++ b/src/runtime/c/pgf/pgf.h @@ -137,6 +137,31 @@ pgf_parse_with_heuristics(PgfConcr* concr, PgfCId cat, GuExn* err, GuPool* pool, GuPool* out_pool); +typedef struct PgfOracleCallback PgfOracleCallback; + +struct PgfOracleCallback { + bool (*predict) (PgfOracleCallback* self, + PgfCId cat, + GuString label, + size_t offset); + bool (*complete)(PgfOracleCallback* self, + PgfCId cat, + GuString label, + size_t offset); + PgfExprProb* (*literal)(PgfOracleCallback* self, + PgfCId cat, + GuString label, + size_t* poffset, + GuPool *out_pool); +}; + +PgfExprEnum* +pgf_parse_with_oracle(PgfConcr* concr, PgfCId cat, + GuString sentence, + PgfOracleCallback* oracle, + GuExn* err, + GuPool* pool, GuPool* out_pool); + typedef struct { PgfToken tok; PgfCId cat; -- cgit v1.2.3