diff options
| author | aarne <aarne@chalmers.se> | 2013-11-05 20:42:22 +0000 |
|---|---|---|
| committer | aarne <aarne@chalmers.se> | 2013-11-05 20:42:22 +0000 |
| commit | e4c6ca41a77eb7d395fbd451c5d18520f18fa7dd (patch) | |
| tree | 5c495dbe68be341255b3e61d286826cf09cd6070 /src/compiler/GF/Command | |
| parent | 027ea815528b4ad991821ff98922e2e7e07dae58 (diff) | |
added a -treebank option to the lc command
Diffstat (limited to 'src/compiler/GF/Command')
| -rw-r--r-- | src/compiler/GF/Command/Commands.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index 5b3737553..6769b283d 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -541,6 +541,7 @@ allCommands = Map.fromList [ ], exec = \env@(pgf, mos) opts -> return . fromStrings . optLins pgf (opts ++ [OOpt "chunks"]), options = [ + ("treebank","show the tree and tag linearizations with language names") ] ++ stringOpOptions, flags = [ ("lang","the languages of linearization (comma-separated, no spaces)") @@ -1170,12 +1171,16 @@ allCommands = Map.fromList [ _ -> map (optLin pgf opts) ts optLin pgf opts t = unlines $ case opts of + _ | isOpt "treebank" opts && isOpt "chunks" opts -> + (showCId (abstractName pgf) ++ ": " ++ showExpr [] t) : + [showCId lang ++ ": " ++ li | (lang,li) <- linChunks pgf opts t] --linear pgf opts lang t | lang <- optLangs pgf opts] _ | isOpt "treebank" opts -> (showCId (abstractName pgf) ++ ": " ++ showExpr [] t) : [showCId lang ++ ": " ++ linear pgf opts lang t | lang <- optLangs pgf opts] - _ | isOpt "chunks" opts -> - [unwords (intersperse "<+>" (map (linear pgf opts lang) (treeChunks t))) | lang <- optLangs pgf opts] - _ -> [linear pgf opts lang t | lang <- optLangs pgf opts] + _ | isOpt "chunks" opts -> map snd $ linChunks pgf opts t + _ -> [linear pgf opts lang t | lang <- optLangs pgf opts] + linChunks pgf opts t = + [(lang, unwords (intersperse "<+>" (map (linear pgf opts lang) (treeChunks t)))) | lang <- optLangs pgf opts] linear :: PGF -> [Option] -> CId -> Expr -> String linear pgf opts lang = let unl = unlex opts lang in case opts of |
