mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-22 01:22:51 -06:00
test probabilities for resource; rounding of prob sum
This commit is contained in:
@@ -200,7 +200,8 @@ hitRegion d vs = case vs of
|
|||||||
checkSGrammar :: SGrammar -> Err SGrammar
|
checkSGrammar :: SGrammar -> Err SGrammar
|
||||||
checkSGrammar = mapMTree chCat where
|
checkSGrammar = mapMTree chCat where
|
||||||
chCat (c,rs) = case sum [p | ((p,f),_) <- rs] of
|
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)
|
_ -> return (c,rs)
|
||||||
|
|
||||||
-- for cases where explicit probability is not given (encoded as
|
-- for cases where explicit probability is not given (encoded as
|
||||||
|
|||||||
Reference in New Issue
Block a user