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 1bf55bbf95
commit aa8168e88f
3 changed files with 9 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
all: langs test
test:
echo "gr -cat=S -number=11 -cf | tb" | gf langs.gfcm
echo "gr -cat=S -number=11 -prob | tb" | gf -probs=lang.gfprob langs.gfcm
langs:
echo "s ;; pm | wf langs.gfcm" | gf -src */Lang??*.gf english/LangEng.gf

View File

@@ -0,0 +1,6 @@
--# prob ConjNP 0.05
--# prob ConjAP 0.1
--# prob ConjAdv 0.1
--# prob ConjS 0.1
--# prob PredSCVP 0.05
--# prob PredetNP 0.05

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