1
0
forked from GitHub/gf-core

test probabilities for resource; rounding of prob sum

This commit is contained in:
aarne
2006-02-09 10:54:07 +00:00
parent fd9da86d24
commit 167a6dd60a

View File

@@ -200,7 +200,8 @@ hitRegion d vs = case vs of
checkSGrammar :: SGrammar -> Err SGrammar
checkSGrammar = mapMTree chCat where
chCat (c,rs) = case sum [p | ((p,f),_) <- rs] of
s | s /= 1.0 -> Bad $ "illegal probability sum " ++ show s ++ " in " ++ c
s | abs (s - 1.0) > 0.01 ->
Bad $ "illegal probability sum " ++ show s ++ " in " ++ c
_ -> return (c,rs)
-- for cases where explicit probability is not given (encoded as