forked from GitHub/gf-core
test probabilities for resource; rounding of prob sum
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
6
lib/resource-1.0/lang.gfprob
Normal file
6
lib/resource-1.0/lang.gfprob
Normal 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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user