diff options
| author | aarne <aarne@chalmers.se> | 2013-11-05 17:28:47 +0000 |
|---|---|---|
| committer | aarne <aarne@chalmers.se> | 2013-11-05 17:28:47 +0000 |
| commit | aba666c5bc7a46cdc7de7e2a36869456c34909bd (patch) | |
| tree | a5b8f7a8f8ba8a7778d4bf72c388fb0a5b8853ad /src/compiler/GF/Command/Commands.hs | |
| parent | 3814841d7d3b77b3f033cb98c1c0a04ac39435d7 (diff) | |
linearization by chunks in the GF shell: a new command 'lc' needed because 'l' requires type checking and trees with metavariable function heads don't type check. This will hopefully be a temporary command.
Diffstat (limited to 'src/compiler/GF/Command/Commands.hs')
| -rw-r--r-- | src/compiler/GF/Command/Commands.hs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index a05b3cf20..5b3737553 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -516,9 +516,9 @@ allCommands = Map.fromList [ ], exec = \env@(pgf, mos) opts -> return . fromStrings . optLins pgf opts, options = [ - ("all","show all forms and variants, one by line (cf. l -list)"), + ("all", "show all forms and variants, one by line (cf. l -list)"), ("bracket","show tree structure with brackets and paths to nodes"), - ("groups","all languages, grouped by lang, remove duplicate strings"), + ("groups", "all languages, grouped by lang, remove duplicate strings"), ("list","show all forms and variants, comma-separated on one line (cf. l -all)"), ("multi","linearize to all languages (default)"), ("table","show all forms labelled by parameters"), @@ -529,6 +529,24 @@ allCommands = Map.fromList [ ("unlexer","set unlexers separately to each language (space-separated)") ] }), + ("lc", emptyCommandInfo { + longname = "linearize_chunks", + synopsis = "linearize a tree that has metavariables in maximal chunks without them", + explanation = unlines [ + "A hopefully temporary command, intended to work around the type checker that fails", + "trees where a function node is a metavariable." + ], + examples = [ + mkEx "l -lang=LangSwe,LangNor -chunks ? a b (? c d)" + ], + exec = \env@(pgf, mos) opts -> return . fromStrings . optLins pgf (opts ++ [OOpt "chunks"]), + options = [ + ] ++ stringOpOptions, + flags = [ + ("lang","the languages of linearization (comma-separated, no spaces)") + ], + needsTypeCheck = False + }), ("ma", emptyCommandInfo { longname = "morpho_analyse", synopsis = "print the morphological analyses of all words in the string", @@ -1155,6 +1173,8 @@ allCommands = Map.fromList [ _ | 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] linear :: PGF -> [Option] -> CId -> Expr -> String |
