1
0
forked from GitHub/gf-core

the C runtime now has a type prob_t which is used only for probability values

This commit is contained in:
kr.angelov
2012-09-18 09:18:48 +00:00
parent dd0e9411e1
commit 44df7a33cf
5 changed files with 35 additions and 31 deletions

View File

@@ -655,11 +655,11 @@ pgf_compute_meta_probs(GuMapItor* fn, const void* key, void* value, GuExn* err)
cat->name = name;
double mass = 0;
prob_t mass = 0;
for (size_t i = 0; i < cat->n_functions; i++) {
mass += cat->functions[i].prob;
}
cat->meta_prob = - log(fabs(1 - mass));
cat->meta_prob = (mass > 1) ? INFINITY : - log(1 - mass);
cat->meta_token_prob = INFINITY;
cat->meta_child_probs = NULL;
}