forked from GitHub/gf-core
bugfix in the C parser
This commit is contained in:
@@ -148,7 +148,7 @@ typedef GuMap PgfMetaChildMap;
|
|||||||
extern GU_DECLARE_TYPE(PgfMetaChildMap, GuMap);
|
extern GU_DECLARE_TYPE(PgfMetaChildMap, GuMap);
|
||||||
|
|
||||||
struct PgfCat {
|
struct PgfCat {
|
||||||
// TODO: Add cid here
|
PgfCId name;
|
||||||
PgfHypos context;
|
PgfHypos context;
|
||||||
|
|
||||||
float meta_prob;
|
float meta_prob;
|
||||||
|
|||||||
@@ -1042,7 +1042,7 @@ pgf_parsing_meta_predict(GuMapItor* fn, const void* key, void* value, GuExn* err
|
|||||||
{
|
{
|
||||||
(void) (err);
|
(void) (err);
|
||||||
|
|
||||||
PgfCId abscat = *((PgfCId*) key);
|
PgfCat* abscat = (PgfCat*) key;
|
||||||
float meta_prob = *((float*) value);
|
float meta_prob = *((float*) value);
|
||||||
PgfMetaPredictFn* clo = (PgfMetaPredictFn*) fn;
|
PgfMetaPredictFn* clo = (PgfMetaPredictFn*) fn;
|
||||||
PgfParseState* before = clo->before;
|
PgfParseState* before = clo->before;
|
||||||
@@ -1050,7 +1050,7 @@ pgf_parsing_meta_predict(GuMapItor* fn, const void* key, void* value, GuExn* err
|
|||||||
PgfItem* meta_item = clo->meta_item;
|
PgfItem* meta_item = clo->meta_item;
|
||||||
|
|
||||||
PgfCncCat* cnccat =
|
PgfCncCat* cnccat =
|
||||||
gu_map_get(before->ps->concr->cnccats, &abscat, PgfCncCat*);
|
gu_map_get(before->ps->concr->cnccats, &abscat->name, PgfCncCat*);
|
||||||
if (cnccat == NULL)
|
if (cnccat == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -648,10 +648,13 @@ typedef struct {
|
|||||||
static void
|
static void
|
||||||
pgf_compute_meta_probs(GuMapItor* fn, const void* key, void* value, GuExn* err)
|
pgf_compute_meta_probs(GuMapItor* fn, const void* key, void* value, GuExn* err)
|
||||||
{
|
{
|
||||||
(void) (key && err);
|
(void) (err);
|
||||||
|
|
||||||
|
PgfCId name = *((PgfCId*) key);
|
||||||
PgfCat* cat = *((PgfCat**) value);
|
PgfCat* cat = *((PgfCat**) value);
|
||||||
|
|
||||||
|
cat->name = name;
|
||||||
|
|
||||||
double mass = 0;
|
double mass = 0;
|
||||||
for (size_t i = 0; i < cat->n_functions; i++) {
|
for (size_t i = 0; i < cat->n_functions; i++) {
|
||||||
mass += cat->functions[i].prob;
|
mass += cat->functions[i].prob;
|
||||||
|
|||||||
Reference in New Issue
Block a user