forked from GitHub/gf-core
fixed some bugs in translation quiz
This commit is contained in:
@@ -686,8 +686,8 @@ allCommands env@(pgf, mos) = Map.fromList [
|
|||||||
syntax = "tq -from=LANG -to=LANG (-cat=CAT)? (-probs=FILE)? TREE?",
|
syntax = "tq -from=LANG -to=LANG (-cat=CAT)? (-probs=FILE)? TREE?",
|
||||||
synopsis = "start a translation quiz",
|
synopsis = "start a translation quiz",
|
||||||
exec = \opts xs -> do
|
exec = \opts xs -> do
|
||||||
let from = valCIdOpts "from" (optLang opts) opts
|
let from = optLangFlag "from" opts
|
||||||
let to = valCIdOpts "to" (optLang opts) opts
|
let to = optLangFlag "to" opts
|
||||||
let typ = optType opts
|
let typ = optType opts
|
||||||
let mt = mexp xs
|
let mt = mexp xs
|
||||||
pgf <- optProbs opts pgf
|
pgf <- optProbs opts pgf
|
||||||
@@ -990,7 +990,10 @@ allCommands env@(pgf, mos) = Map.fromList [
|
|||||||
optRestricted opts =
|
optRestricted opts =
|
||||||
restrictPGF (\f -> and [hasLin pgf la f | la <- optLangs opts]) pgf
|
restrictPGF (\f -> and [hasLin pgf la f | la <- optLangs opts]) pgf
|
||||||
|
|
||||||
optLangs opts = case valStrOpts "lang" "" opts of
|
optLang = optLangFlag "lang"
|
||||||
|
optLangs = optLangsFlag "lang"
|
||||||
|
|
||||||
|
optLangsFlag f opts = case valStrOpts f "" opts of
|
||||||
"" -> languages pgf
|
"" -> languages pgf
|
||||||
lang -> map completeLang (chunks ',' lang)
|
lang -> map completeLang (chunks ',' lang)
|
||||||
completeLang la = let cla = (mkCId la) in
|
completeLang la = let cla = (mkCId la) in
|
||||||
@@ -998,7 +1001,7 @@ allCommands env@(pgf, mos) = Map.fromList [
|
|||||||
then cla
|
then cla
|
||||||
else (mkCId (showCId (abstractName pgf) ++ la))
|
else (mkCId (showCId (abstractName pgf) ++ la))
|
||||||
|
|
||||||
optLang opts = head $ optLangs opts ++ [wildCId]
|
optLangFlag f opts = head $ optLangsFlag f opts ++ [wildCId]
|
||||||
|
|
||||||
optOpenTypes opts = case valStrOpts "openclass" "" opts of
|
optOpenTypes opts = case valStrOpts "openclass" "" opts of
|
||||||
"" -> []
|
"" -> []
|
||||||
|
|||||||
@@ -46,8 +46,10 @@ translationList mex pgf ig og typ number = do
|
|||||||
Nothing -> generateRandom gen pgf typ
|
Nothing -> generateRandom gen pgf typ
|
||||||
return $ map mkOne $ ts
|
return $ map mkOne $ ts
|
||||||
where
|
where
|
||||||
mkOne t = (norml (linearize pgf ig t), map (norml . linearize pgf og) (homonyms t))
|
mkOne t = (norml (linearize pgf ig t),
|
||||||
|
map norml (concatMap lins (homonyms t)))
|
||||||
homonyms = parse pgf ig typ . linearize pgf ig
|
homonyms = parse pgf ig typ . linearize pgf ig
|
||||||
|
lins = nub . concatMap (map snd) . tabularLinearizes pgf og
|
||||||
|
|
||||||
morphologyList ::
|
morphologyList ::
|
||||||
Maybe Expr -> PGF -> Language -> Type -> Int -> IO [(String,[String])]
|
Maybe Expr -> PGF -> Language -> Type -> Int -> IO [(String,[String])]
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// minibar.js, assumes that support.js has also been loaded
|
// minibar.js, assumes that support.js has also been loaded
|
||||||
|
|
||||||
var default_server="http://www.grammaticalframework.org:41296"
|
//var default_server="http://www.grammaticalframework.org:41296"
|
||||||
|
var default_server="http://localhost:41296"
|
||||||
|
|
||||||
var tree_icon=default_server+"/translate/se.chalmers.cs.gf.gwt.TranslateApp/tree-btn.png";
|
var tree_icon=default_server+"/translate/se.chalmers.cs.gf.gwt.TranslateApp/tree-btn.png";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user