summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2010-10-02 13:03:57 +0000
committerkrasimir <krasimir@chalmers.se>2010-10-02 13:03:57 +0000
commitcb8795c222ae86e4561e1009c382fe0b87e22b62 (patch)
treeeddba3e578a812347060f5f640cc49e58dc5b263 /src/compiler/GF/Compile.hs
parent72cc4ddb594599a5e3768a7b3921975542c3591a (diff)
refactor the API for random generation again. Now PGF contains probabilities in the abstract syntax
Diffstat (limited to 'src/compiler/GF/Compile.hs')
-rw-r--r--src/compiler/GF/Compile.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/compiler/GF/Compile.hs b/src/compiler/GF/Compile.hs
index ecb533c3f..7c1290d7e 100644
--- a/src/compiler/GF/Compile.hs
+++ b/src/compiler/GF/Compile.hs
@@ -42,6 +42,7 @@ import PGF.CId
import PGF.Data
import PGF.Macros
import PGF.Optimize
+import PGF.Probabilistic
-- | Compiles a number of source files and builds a 'PGF' structure for them.
@@ -55,9 +56,13 @@ link :: Options -> Ident -> SourceGrammar -> IOE PGF
link opts cnc gr = do
let isv = (verbAtLeast opts Normal)
putPointE Normal opts "linking ... " $ do
- gc <- ioeIO (mkCanon2pgf opts cnc gr)
- ioeIO $ putStrLn "OK"
- return $ if flag optOptimizePGF opts then optimizePGF gc else gc
+ pgf <- ioeIO (mkCanon2pgf opts cnc gr)
+ probs <- ioeIO (maybe (return . defaultProbabilities) readProbabilitiesFromFile (flag optProbsFile opts) pgf)
+ ioeIO $ putStrLn "OK"
+ pgf <- return $ setProbabilities probs
+ $ if flag optOptimizePGF opts then optimizePGF pgf else pgf
+ ioeIO $ putStrLn (showProbabilities (getProbabilities pgf))
+ return pgf
batchCompile :: Options -> [FilePath] -> IOE SourceGrammar
batchCompile opts files = do