summaryrefslogtreecommitdiff
path: root/src-3.0/GF/Command
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-06-14 08:51:13 +0000
committeraarne <aarne@cs.chalmers.se>2008-06-14 08:51:13 +0000
commitc1c8257e82ace9860fa3880ae820b2b41b6403e0 (patch)
tree05c296aa403075b1ca45f5df078793cc169cd1c2 /src-3.0/GF/Command
parent4fd51838637b696892f4bde48b6741d84186621e (diff)
added translation and mophology quizzes
Diffstat (limited to 'src-3.0/GF/Command')
-rw-r--r--src-3.0/GF/Command/Commands.hs26
1 files changed, 25 insertions, 1 deletions
diff --git a/src-3.0/GF/Command/Commands.hs b/src-3.0/GF/Command/Commands.hs
index b37143c90..4d9020d87 100644
--- a/src-3.0/GF/Command/Commands.hs
+++ b/src-3.0/GF/Command/Commands.hs
@@ -15,6 +15,7 @@ import PGF.ShowLinearize
import PGF.Macros
import PGF.Data ----
import PGF.Morphology
+import PGF.Quiz
import GF.Compile.Export
import GF.Infra.UseIO
import GF.Data.ErrM ----
@@ -167,6 +168,17 @@ allCommands pgf = Map.fromList [
concatMap words . toStrings
}),
+ ("mq", emptyCommandInfo {
+ longname = "morpho_quiz",
+ synopsis = "start a morphology quiz",
+ exec = \opts _ -> do
+ let lang = optLang opts
+ let cat = optCat opts
+ morphologyQuiz pgf lang cat
+ return void,
+ flags = ["lang","cat","number"]
+ }),
+
("p", emptyCommandInfo {
longname = "parse",
synopsis = "parse a string to abstract syntax expression",
@@ -245,6 +257,17 @@ allCommands pgf = Map.fromList [
_ -> fromString s,
flags = ["file"]
}),
+ ("tq", emptyCommandInfo {
+ longname = "translation_quiz",
+ synopsis = "start a translation quiz",
+ exec = \opts _ -> do
+ let from = valIdOpts "from" (optLang opts) opts
+ let to = valIdOpts "to" (optLang opts) opts
+ let cat = optCat opts
+ translationQuiz pgf from to cat
+ return void,
+ flags = ["from","to","cat","number"]
+ }),
("wf", emptyCommandInfo {
longname = "write_file",
synopsis = "send string or tree to a file",
@@ -276,7 +299,8 @@ allCommands pgf = Map.fromList [
optLangs opts = case valIdOpts "lang" "" opts of
"" -> languages pgf
- lang -> [lang]
+ lang -> [lang]
+ optLang opts = head $ optLangs opts ++ ["#NOLANG"]
optCat opts = valIdOpts "cat" (lookStartCat pgf) opts
optNum opts = valIntOpts "number" 1 opts
optNumInf opts = valIntOpts "number" 1000000000 opts ---- 10^9