1
0
forked from GitHub/gf-core

bugfix: setProbabilities should be more robust when there are missing probabilities for some functions or categories

This commit is contained in:
krasimir
2010-12-17 09:09:07 +00:00
parent cb73519ffd
commit e52f8dda61

View File

@@ -80,7 +80,7 @@ setProbabilities probs pgf = pgf {
}}
where
mapUnionWith f map1 map2 =
Map.mapWithKey (\k v -> f v (fromJust (Map.lookup k map2))) map1
Map.mapWithKey (\k v -> maybe v (f v) (Map.lookup k map2)) map1
-- | compute the probability of a given tree
probTree :: PGF -> Expr -> Double