diff options
| author | aarne <aarne@cs.chalmers.se> | 2005-12-02 13:13:14 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2005-12-02 13:13:14 +0000 |
| commit | dea5158cbf1c11d45f2ed91d9975fbc77245e652 (patch) | |
| tree | 751ef7bcaccf58c43354d5b1767d3b3d3d1ac34d /src/GF/Probabilistic/Probabilistic.hs | |
| parent | 50ddb387f4495beb8bd8da2b9726a087a489df68 (diff) | |
floats in GF and GFC (parsing user input still doesn't work)
Diffstat (limited to 'src/GF/Probabilistic/Probabilistic.hs')
| -rw-r--r-- | src/GF/Probabilistic/Probabilistic.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/GF/Probabilistic/Probabilistic.hs b/src/GF/Probabilistic/Probabilistic.hs index 5b5c6b2af..c9bc1b8b2 100644 --- a/src/GF/Probabilistic/Probabilistic.hs +++ b/src/GF/Probabilistic/Probabilistic.hs @@ -125,6 +125,7 @@ str2tr t = case t of SMeta _ -> mkMeta 0 SString s -> K s SInt i -> EInt i + SFloat i -> EFloat i where trId = cn . zIdent @@ -142,7 +143,8 @@ data STree = -- | SAppN (SIdent,[STree]) -- no probability given | SMeta SCat | SString String - | SInt Int + | SInt Integer + | SFloat Double deriving (Show,Eq) probTree :: STree -> Double @@ -165,6 +167,7 @@ genTree :: [Double] -> SGrammar -> SCat -> (STree,Int) genTree rs gr = gett rs where gett ds "String" = (SString "foo",1) gett ds "Int" = (SInt 1978,1) + gett ds "Float" = (SFloat 3.1415926, 1) gett ds cat = case look cat of [] -> (SMeta cat,1) -- if no productions, return ? fs -> let @@ -212,6 +215,7 @@ prSTree t = case t of SMeta c -> '?':c SString s -> prQuotedString s SInt i -> show i + SFloat i -> show i where pr1 t@(SApp (_,ts)) = ' ' : (if null ts then id else prParenth) (prSTree t) pr1 t = prSTree t |
