summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Infra
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-02-12 10:53:13 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-02-12 10:53:13 +0000
commit4922ab6cc495087f40399746f616cd88590fd884 (patch)
treeb180f222f96c7e286337681efdc6834b94f6e3e8 /src/compiler/GF/Infra
parenta4c9d20fc3a92dc2e80208d4fe7b4f54a64a17af (diff)
now the beam size for the statistical parser can be configured by using the flag beam_size in the top-level concrete module
Diffstat (limited to 'src/compiler/GF/Infra')
-rw-r--r--src/compiler/GF/Infra/Option.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/GF/Infra/Option.hs b/src/compiler/GF/Infra/Option.hs
index d07a96112..a1e69d027 100644
--- a/src/compiler/GF/Infra/Option.hs
+++ b/src/compiler/GF/Infra/Option.hs
@@ -172,6 +172,7 @@ data Flags = Flags {
optWarnings :: [Warning],
optDump :: [Dump],
optTagsOnly :: Bool,
+ optBeamSize :: Maybe Double,
optNewComp :: Bool
}
deriving (Show)
@@ -216,6 +217,7 @@ optionsPGF :: Options -> [(String,String)]
optionsPGF opts =
maybe [] (\x -> [("language",x)]) (flag optSpeechLanguage opts)
++ maybe [] (\x -> [("startcat",x)]) (flag optStartCat opts)
+ ++ maybe [] (\x -> [("beam_size",show x)]) (flag optBeamSize opts)
-- Option manipulation
@@ -272,6 +274,7 @@ defaultFlags = Flags {
optWarnings = [],
optDump = [],
optTagsOnly = False,
+ optBeamSize = Nothing,
optNewComp =
#ifdef NEW_COMP
True
@@ -357,6 +360,7 @@ optDescr =
Option [] ["stem"] (onOff (toggleOptimize OptStem) True) "Perform stem-suffix analysis (default on).",
Option [] ["cse"] (onOff (toggleOptimize OptCSE) True) "Perform common sub-expression elimination (default on).",
Option [] ["cfg"] (ReqArg cfgTransform "TRANS") "Enable or disable specific CFG transformations. TRANS = merge, no-merge, bottomup, no-bottomup, ...",
+ Option [] ["beam_size"] (ReqArg readDouble "SIZE") "Set the beam size for statistical parsing",
Option [] ["new-comp"] (NoArg (set $ \o -> o{optNewComp = True})) "Use the new experimental compiler.",
Option [] ["old-comp"] (NoArg (set $ \o -> o{optNewComp = False})) "Use old trusty compiler.",
dumpOption "source" Source,
@@ -431,6 +435,10 @@ optDescr =
Nothing -> fail $ "Unknown CFG transformation: " ++ x'
++ " Known: " ++ show (map fst cfgTransformNames)
+ readDouble x = case reads x of
+ [(d,"")] -> set $ \o -> o { optBeamSize = Just d }
+ _ -> fail "A floating point number is expected"
+
dumpOption s d = Option [] ["dump-"++s] (NoArg (set $ \o -> o { optDump = Dump d:optDump o})) ("Dump output of the " ++ s ++ " phase.")
set = return . Options