mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-21 00:52:51 -06:00
more treebank options; updated history
This commit is contained in:
@@ -14,6 +14,22 @@ Changes in functionality since May 17, 2005, release of GF Version 2.2
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
|
6/3 (AR) Generalized the <tt>gfe</tt> file format in two ways:
|
||||||
|
<ol>
|
||||||
|
<li> Use the real grammar parser, hence <tt>(in M.C "foo")</tt> expressions
|
||||||
|
may occur anywhere. But the <i>ad hoc</i> word substitution syntax is
|
||||||
|
abandoned: ordinary <tt>let</tt> (and <tt>where</tt>) expressions
|
||||||
|
can now be used instead.
|
||||||
|
<li> The resource may now be a treebank, not just a grammar. Parsing
|
||||||
|
is thus replaced by treebank lookup, which in most cases is faster.
|
||||||
|
</ol>
|
||||||
|
A minor novelty is that the <tt>--# -resource=FILE</tt> flag can now be
|
||||||
|
relative to <tt>GF_LIB_PATH</tt>, both for grammars and treebanks.
|
||||||
|
The flag <tt> --# -treebank=IDENT</tt> gives the language whose treebank
|
||||||
|
entries are used, in case of a multilingual treebank.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
4/3 (AR) Added command <tt>use_treebank = ut</tt> for lookup in a treebank.
|
4/3 (AR) Added command <tt>use_treebank = ut</tt> for lookup in a treebank.
|
||||||
This command can be used as a fast substitute for parsing, but also as a
|
This command can be used as a fast substitute for parsing, but also as a
|
||||||
way to browse treebanks.
|
way to browse treebanks.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--# -resource=../../lib/multimodal/MultimodalEng.gfc
|
--# -resource=multimodal/MultimodalEng.gfc
|
||||||
--# -path=multimodal:present:mathematical:prelude
|
--# -path=multimodal:present:mathematical:prelude
|
||||||
|
|
||||||
incomplete concrete TramI of Tram = open Multimodal, DemRes, Symbol in {
|
incomplete concrete TramI of Tram = open Multimodal, DemRes, Symbol in {
|
||||||
|
|||||||
@@ -65,7 +65,10 @@ mkCncGroups opts0 ((res,path),files) = do
|
|||||||
putStrLn $ "Compiling resource " ++ res
|
putStrLn $ "Compiling resource " ++ res
|
||||||
let opts = addOptions (options [beSilent,pathList path]) opts0
|
let opts = addOptions (options [beSilent,pathList path]) opts0
|
||||||
let treebank = oElem (iOpt "treebank") opts
|
let treebank = oElem (iOpt "treebank") opts
|
||||||
egr <- appIOE $ shellStateFromFiles opts emptyShellState res
|
resf <- useIOE res $ do
|
||||||
|
(fp,_) <- readFileLibraryIOE gfLibraryPath res
|
||||||
|
return fp
|
||||||
|
egr <- appIOE $ shellStateFromFiles opts emptyShellState resf
|
||||||
(parser,morpho) <- if treebank then do
|
(parser,morpho) <- if treebank then do
|
||||||
tb <- err (\_ -> error $ "no treebank of name" +++ path)
|
tb <- err (\_ -> error $ "no treebank of name" +++ path)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -319,6 +319,8 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com
|
|||||||
returnArg (AString $ unlines $ lookupTreebank tb s) sa
|
returnArg (AString $ unlines $ lookupTreebank tb s) sa
|
||||||
_ | oElem (iOpt "assocs") opts -> do
|
_ | oElem (iOpt "assocs") opts -> do
|
||||||
returnArg (AString $ unlines $ map printAssoc $ assocsTreebank tb) sa
|
returnArg (AString $ unlines $ map printAssoc $ assocsTreebank tb) sa
|
||||||
|
_ | oElem (iOpt "trees") opts -> do
|
||||||
|
returnArg (ATrms $ str2trees $ concatMap snd $ assocsTreebank tb) sa
|
||||||
_ -> do
|
_ -> do
|
||||||
let tes = map (string2treeErr gro) $ lookupTreebank tb s
|
let tes = map (string2treeErr gro) $ lookupTreebank tb s
|
||||||
terms = [t | Ok t <- tes]
|
terms = [t | Ok t <- tes]
|
||||||
@@ -442,6 +444,8 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com
|
|||||||
AString s -> err AError (ATrms . return) $ string2treeErr gro s
|
AString s -> err AError (ATrms . return) $ string2treeErr gro s
|
||||||
_ -> a
|
_ -> a
|
||||||
|
|
||||||
|
str2trees ts = [t | Ok t <- map (string2treeErr gro) ts]
|
||||||
|
|
||||||
strees a = case a of
|
strees a = case a of
|
||||||
ATrms ts -> ts
|
ATrms ts -> ts
|
||||||
_ -> []
|
_ -> []
|
||||||
|
|||||||
@@ -252,7 +252,8 @@ txtHelpFile =
|
|||||||
"\n options:" ++
|
"\n options:" ++
|
||||||
"\n -assocs show all string-trees associations in the treebank" ++
|
"\n -assocs show all string-trees associations in the treebank" ++
|
||||||
"\n -strings show all strings in the treebank" ++
|
"\n -strings show all strings in the treebank" ++
|
||||||
"\n -raw return result as string, without typechecking it" ++
|
"\n -trees show all trees in the treebank" ++
|
||||||
|
"\n -raw return the lookup result as string, without typechecking it" ++
|
||||||
"\n flags:" ++
|
"\n flags:" ++
|
||||||
"\n -treebank use this treebank (instead of the latest introduced one)" ++
|
"\n -treebank use this treebank (instead of the latest introduced one)" ++
|
||||||
"\n examples:" ++
|
"\n examples:" ++
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ optionsOfCommand co = case co of
|
|||||||
CGenerateTrees -> both "metas" "atoms depth alts cat lang number"
|
CGenerateTrees -> both "metas" "atoms depth alts cat lang number"
|
||||||
CPutTerm -> flags "transform number"
|
CPutTerm -> flags "transform number"
|
||||||
CTreeBank -> opts "c xml trees"
|
CTreeBank -> opts "c xml trees"
|
||||||
CLookupTreebank -> both "assocs raw strings" "treebank"
|
CLookupTreebank -> both "assocs raw strings trees" "treebank"
|
||||||
CWrapTerm _ -> opts "c"
|
CWrapTerm _ -> opts "c"
|
||||||
CApplyTransfer _ -> flags "lang transfer"
|
CApplyTransfer _ -> flags "lang transfer"
|
||||||
CMorphoAnalyse -> both "short" "lang"
|
CMorphoAnalyse -> both "short" "lang"
|
||||||
|
|||||||
@@ -223,7 +223,8 @@ ut, use_treebank: ut String
|
|||||||
options:
|
options:
|
||||||
-assocs show all string-trees associations in the treebank
|
-assocs show all string-trees associations in the treebank
|
||||||
-strings show all strings in the treebank
|
-strings show all strings in the treebank
|
||||||
-raw return result as string, without typechecking it
|
-trees show all trees in the treebank
|
||||||
|
-raw return the lookup result as string, without typechecking it
|
||||||
flags:
|
flags:
|
||||||
-treebank use this treebank (instead of the latest introduced one)
|
-treebank use this treebank (instead of the latest introduced one)
|
||||||
examples:
|
examples:
|
||||||
|
|||||||
Reference in New Issue
Block a user