From 32508e37b37a0baad884e6aaa518071b62e1e6d8 Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 2 Mar 2006 17:19:36 +0000 Subject: treebanks in shell state: i -treebank and lt --- src/GF/Shell.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/GF/Shell.hs') diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs index 0d5332fb8..39460b2f2 100644 --- a/src/GF/Shell.hs +++ b/src/GF/Shell.hs @@ -181,6 +181,10 @@ execLine put (c@(co, os), arg, cs) (outps,st) = do execC :: CommandOpt -> ShellIO execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case comm of + CImport file | oElem (iOpt "treebank") opts -> do + ss <- readFileIf file >>= return . lines + let tb = pre2treebank $ getTreebank ss + changeState (addTreebank (I.identC (takeWhile (/='.') file), tb)) sa CImport file | oElem fromExamples opts -> do es <- liftM nub $ getGFEFiles opts file system $ "gf -examples" +++ unlines es @@ -303,6 +307,15 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com comm = "command" ---- returnArg (AString $ unlines $ mkTreebank opts st comm ts) sa + CLookupTreebank -> do + case treebanks st of + [] -> returnArg (AError "no treebank") sa + (_,tb):_ -> do + let s = prCommandArg a + let tes = map (string2treeErr gro . snd) $ lookupTreebank tb s + terms = [t | Ok t <- tes] + returnArg (ATrms terms) sa + CShowTreeGraph | oElem emitCode opts -> do -- -o returnArg (AString $ visualizeTrees opts $ strees $ s2t a) sa CShowTreeGraph -> do -- cgit v1.2.3