mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-11 22:09:32 -06:00
l -multi -all/-table ; same with tb
This commit is contained in:
@@ -12,6 +12,9 @@ Changes in functionality since May 17, 2005, release of GF Version 2.2
|
||||
|
||||
</center>
|
||||
|
||||
30/5 (AR) It is now possible to use the flags <tt>-all, -table, -record</tt>
|
||||
in combination with <tt>l -multi</tt>, and also with <tt>tb</tt>.
|
||||
|
||||
<p>
|
||||
|
||||
18/5 (AR) Introduced a wordlist format <tt>gfwl</tt> for
|
||||
|
||||
@@ -1910,7 +1910,7 @@ of such a theory, represented as an ``abstract`` module in GF.
|
||||
|
||||
A resource grammar is a grammar built on linguistic grounds,
|
||||
to describe a language rather than a domain.
|
||||
The GF resource grammar library contains resource grammars for
|
||||
The GF resource grammar library, which contains resource grammars for
|
||||
10 languages, is described more closely in the following
|
||||
documents:
|
||||
- [Resource library API documentation ../../lib/resource-1.0/doc/]:
|
||||
|
||||
@@ -5,7 +5,7 @@ concrete IdiomDan of Idiom = CatDan **
|
||||
|
||||
lin
|
||||
ImpersCl vp = mkClause "det" (agrP3 neutrum Sg) vp ;
|
||||
GenericCl vp = mkClause "man" (agrP3 neutrum Sg) vp ;
|
||||
GenericCl vp = mkClause "man" (agrP3 utrum Sg) vp ;
|
||||
|
||||
ExistNP np =
|
||||
mkClause "det" (agrP3 neutrum Sg) (insertObj
|
||||
|
||||
@@ -12,7 +12,7 @@ lin
|
||||
airplane_N = mk2N "fly" "flyet" ;
|
||||
answer_V2S = mkV2S (regV "svare") "til" ;
|
||||
apartment_N = mk2N "værelse" "værelsen" ;
|
||||
apple_N = mk2N "æble" "æblet" ;
|
||||
apple_N = mk3N "æble" "æblet" "æbler" ;
|
||||
art_N = mk2N "kunst" "kunsten" ;
|
||||
ask_V2Q = mkV2Q spørge_V [] ;
|
||||
baby_N = mk2N "baby" "babyen" ; ---- babyen
|
||||
@@ -252,7 +252,7 @@ lin
|
||||
cloud_N = mk2N "sky" "skyen" ;
|
||||
day_N = mk3N "dag" "dagen" "dage" ;
|
||||
dust_N = mk2N "støv" "støvet" ;
|
||||
ear_N = mk2N "øre" "øret" ;
|
||||
ear_N = mk3N "øre" "øret" "ører" ;
|
||||
earth_N = mk2N "jord" "jorden" ;
|
||||
egg_N = mk2N "æg" "æget" ;
|
||||
eye_N = mk3N "øje" "øjet" "øjne" ;
|
||||
@@ -269,7 +269,7 @@ lin
|
||||
hair_N = mk2N "hår" "håret" ;
|
||||
hand_N = mk2N "hånd" "hånden" ;
|
||||
head_N = mk2N "hoved" "hovedet" ;
|
||||
heart_N = mk2N "hjerte" "hjertet" ;
|
||||
heart_N = mk3N "hjerte" "hjertet" "hjerter" ;
|
||||
horn_N = mk2N "horn" "hornet" ;
|
||||
husband_N = mk2N "ægtefælle" "ægtefællen" ; ----
|
||||
ice_N = mk2N "is" "isen" ;
|
||||
|
||||
@@ -226,6 +226,8 @@ oper
|
||||
|
||||
vaereV : V -> V ;
|
||||
|
||||
|
||||
|
||||
--3 Verbs with a particle
|
||||
--
|
||||
-- The particle, such as in "switch on", is given as a string.
|
||||
|
||||
@@ -79,7 +79,7 @@ concrete StructuralDan of Structural = CatDan **
|
||||
there7to_Adv = ss "dit" ;
|
||||
there7from_Adv = ss "derfra" ;
|
||||
therefore_PConj = ss "derfor" ;
|
||||
these_NP = regNP ["de her"] ["det hers"] Plg ;
|
||||
these_NP = regNP ["disse"] ["disses"] Plg ;
|
||||
they_Pron = MorphoDan.mkNP "de" "dem" "deres" "deres" "deres" Plg P1 ;
|
||||
this_Quant =
|
||||
{s = table {
|
||||
@@ -88,7 +88,7 @@ concrete StructuralDan of Structural = CatDan **
|
||||
} ;
|
||||
det = DDef Indef
|
||||
} ;
|
||||
this_NP = regNP ["det her"] ["det hers"] SgNeutr ;
|
||||
this_NP = regNP ["dette"] ["dettes"] SgNeutr ;
|
||||
those_NP = regNP ["de der"] ["de ders"] Plg ;
|
||||
through_Prep = ss "gennem" ;
|
||||
too_AdA = ss "for" ;
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
30/5/2006
|
||||
|
||||
LangFre
|
||||
|
||||
231m, 48s, *.gfc 718k
|
||||
|
||||
--------------
|
||||
|
||||
11/5/2006
|
||||
|
||||
LangFre
|
||||
|
||||
@@ -17,15 +17,16 @@ instance DiffNor of DiffScand = open CommonScand, Prelude in {
|
||||
_ => Plg
|
||||
} ;
|
||||
|
||||
detDef : Species = Indef ;
|
||||
detDef : Species = Def ;
|
||||
|
||||
Verb : Type = {
|
||||
s : VForm => Str ;
|
||||
part : Str ;
|
||||
vtype : VType
|
||||
vtype : VType ;
|
||||
isVaere : Bool
|
||||
} ;
|
||||
|
||||
hasAuxBe _ = False ;
|
||||
hasAuxBe v = v.isVaere ;
|
||||
|
||||
-- Strings.
|
||||
|
||||
@@ -44,13 +45,13 @@ instance DiffNor of DiffScand = open CommonScand, Prelude in {
|
||||
|
||||
verbHave =
|
||||
mkVerb "ha" "har" "ha" "hadde" "hatt" nonExist nonExist nonExist
|
||||
** noPart ;
|
||||
** {part = [] ; isVaere = False} ;
|
||||
verbBe =
|
||||
mkVerb "være" "er" "var" "var" "vært" "væren" "været" "værne"
|
||||
** noPart ;
|
||||
** {part = [] ; isVaere = False} ;
|
||||
verbBecome =
|
||||
mkVerb "bli" "blir" "bli" "ble" "blitt" "bliven" "blivet" "blivne"
|
||||
** noPart ;
|
||||
** {part = [] ; isVaere = True} ;
|
||||
|
||||
-- auxiliary
|
||||
noPart = {part = []} ;
|
||||
|
||||
@@ -6,7 +6,7 @@ concrete IdiomNor of Idiom = CatNor **
|
||||
lin
|
||||
|
||||
ImpersCl vp = mkClause "det" (agrP3 neutrum Sg) vp ;
|
||||
GenericCl vp = mkClause "man" (agrP3 neutrum Sg) vp ;
|
||||
GenericCl vp = mkClause "man" (agrP3 utrum Sg) vp ;
|
||||
|
||||
ExistNP np =
|
||||
mkClause "det" (agrP3 neutrum Sg) (insertObj
|
||||
|
||||
@@ -17,9 +17,9 @@ lin
|
||||
bad_A = regADeg "dårlig" ; ----
|
||||
bank_N = mk2N "bank" "banken" ;
|
||||
beautiful_A = mk3ADeg "vakker" "vakkert" "vakra" ;
|
||||
become_VA = mkVA bli_V ;
|
||||
become_VA = mkVA (vaereV bli_V) ;
|
||||
beer_N = regGenN "øl" neutrum ;
|
||||
beg_V2V = mkV2V be_V [] "att" ;
|
||||
beg_V2V = mkV2V be_V [] "at" ;
|
||||
big_A = irregADeg "stor" "større" "størst";
|
||||
bike_N = mkN "sykkel" "sykkelen" "sykler" "syklene" ;
|
||||
bird_N = mk2N "fugl" "fuglen" ;
|
||||
@@ -53,19 +53,19 @@ lin
|
||||
close_V2 = dirV2 (mk2V "lukke" "lukket") ;
|
||||
coat_N = regGenN "frakk" masculine ;
|
||||
cold_A = regADeg "kald" ;
|
||||
come_V = komme_V ;
|
||||
come_V = vaereV komme_V ;
|
||||
computer_N = mk2N "datamaskin" "datamaskinen" ;
|
||||
country_N = mk2N "land" "landet" ;
|
||||
cousin_N = mk2N "fetter" "fetteren" ; ----
|
||||
cow_N = mkN "ku" "kua" "kyr" "kyrne" ; ----
|
||||
die_V = dø_V ;
|
||||
die_V = vaereV dø_V ;
|
||||
dirty_A = mk3ADeg "skitten" "skittent" "skitne" ; ----
|
||||
distance_N3 = mkN3 (regGenN "avstand" masculine) "fra" "til" ;
|
||||
doctor_N = mk2N "lege" "legen" ;
|
||||
dog_N = regGenN "hund" masculine ;
|
||||
door_N = regGenN "dør" feminine ;
|
||||
drink_V2 = dirV2 drikke_V ;
|
||||
easy_A2V = mkA2V (regA "grei") "før" ;
|
||||
easy_A2V = mkA2V (regA "grei") "for" ;
|
||||
eat_V2 = dirV2 (mk2V "spise" "spiste") ;
|
||||
empty_A = mkADeg "tom" "tomt" "tomme" "tommere" "tommest" ;
|
||||
enemy_N = regGenN "fiende" masculine ;
|
||||
@@ -85,7 +85,7 @@ lin
|
||||
glove_N = regGenN "hanske" masculine ;
|
||||
gold_N = regGenN "gull" neutrum ;
|
||||
good_A = mkADeg "god" "godt" "gode" "bedre" "best" ;
|
||||
go_V = gå_V ;
|
||||
go_V = vaereV gå_V ;
|
||||
green_A = mk2ADeg "grønn" "grønt" ;
|
||||
harbour_N = regGenN "havn" feminine;
|
||||
hate_V2 = dirV2 (regV "hate") ;
|
||||
@@ -150,7 +150,7 @@ lin
|
||||
rock_N = regGenN "stein" masculine ;
|
||||
roof_N = regGenN "tak" neutrum ;
|
||||
rubber_N = mk2N "gummi" "gummien" ;
|
||||
run_V = springe_V ;
|
||||
run_V = vaereV springe_V ;
|
||||
say_VS = mkVS si_V ;
|
||||
school_N = regGenN "skole" feminine;
|
||||
science_N = mk2N "vitenskap" "vitenskapen" ;
|
||||
@@ -189,7 +189,7 @@ lin
|
||||
thick_A = mk2ADeg "tykk" "tykt" ;
|
||||
thin_A = mk2ADeg "tynn" "tynt" ;
|
||||
train_N = regGenN "tog" neutrum ;
|
||||
travel_V = mk2V "reise" "reiste" ;
|
||||
travel_V = vaereV (mk2V "reise" "reiste") ;
|
||||
tree_N = mkN "tre" "treet" "trær" "træne" ;
|
||||
---- trousers_N = regGenN "trousers" ; ---- pl t !
|
||||
ugly_A = mk2ADeg "stygg" "stygt" ;
|
||||
@@ -197,7 +197,7 @@ lin
|
||||
university_N = regGenN "universitet" neutrum ;
|
||||
village_N = mk2N "grend" "grenda" ;
|
||||
wait_V2 = mkV2 (regV "vente") "på" ;
|
||||
walk_V = (irregV "gå" "gikk" "gått") ;
|
||||
walk_V = vaereV gå_V ;
|
||||
warm_A = regADeg "varm" ;
|
||||
war_N = regGenN "krig" masculine ;
|
||||
watch_V2 = mkV2 se_V "på" ;
|
||||
@@ -220,7 +220,7 @@ lin
|
||||
add_V3 = mkV3 (partV (irregV "legge" "la" "lagt") "til") [] "til" ;
|
||||
number_N = mk2N "nummer" "nummeret" ;
|
||||
put_V2 = mkV2 (irregV "sette" "satte" "satt") [] ;
|
||||
stop_V = regV "stanse" ;
|
||||
stop_V = vaereV (regV "stanse") ;
|
||||
jump_V = regV "hoppe" ;
|
||||
|
||||
left_Ord = {s = "venstre" ; isDet = True} ;
|
||||
@@ -308,12 +308,12 @@ lin
|
||||
count_V2 = dirV2 (regV "regne") ;
|
||||
cut_V2 = dirV2 (skjære_V) ;
|
||||
dig_V = mk2V "grave" "gravde" ;
|
||||
fall_V = falle_V ;
|
||||
fall_V = vaereV falle_V ;
|
||||
fear_V2 = dirV2 (regV "frykte") ;
|
||||
fight_V2 = dirV2 (slåss_V) ;
|
||||
float_V = flyte_V ;
|
||||
flow_V = renne_V ;
|
||||
fly_V = fly_V ;
|
||||
fly_V = vaereV fly_V ;
|
||||
freeze_V = fryse_V ;
|
||||
give_V3 = dirdirV3 gi_V ;
|
||||
hit_V2 = dirV2 (slå_V) ;
|
||||
@@ -335,7 +335,7 @@ lin
|
||||
split_V2 = dirV2 (mk2V "kløyve" "kløyvde") ;
|
||||
squeeze_V2 = dirV2 (mk2V "klemme" "klemte") ;
|
||||
stab_V2 = dirV2 (stikke_V) ;
|
||||
stand_V = stå_V ;
|
||||
stand_V = vaereV stå_V ;
|
||||
suck_V2 = dirV2 (suge_V) ;
|
||||
swell_V = partV (regV "hovne") "opp" ;
|
||||
swim_V = regV "simme" ;
|
||||
|
||||
@@ -217,6 +217,13 @@ oper
|
||||
irregV : (drikke, drakk, drukket : Str) -> V ;
|
||||
|
||||
|
||||
--3 Verbs with "være" as auxiliary
|
||||
--
|
||||
-- By default, the auxiliary is "have". This function changes it to "være".
|
||||
|
||||
vaereV : V -> V ;
|
||||
|
||||
|
||||
--3 Verbs with a particle.
|
||||
--
|
||||
-- The particle, such as in "switch on", is given as a string.
|
||||
@@ -357,14 +364,14 @@ oper
|
||||
mkPreposition p = p ;
|
||||
|
||||
mkV a b c d e f = mkVerb6 a b c d e f **
|
||||
{part = [] ; vtype = VAct ; lock_V = <>} ;
|
||||
{part = [] ; vtype = VAct ; isVaere = False ; lock_V = <>} ;
|
||||
|
||||
regV a = case last a of {
|
||||
"e" => vHusk (init a) ;
|
||||
_ => vBo a
|
||||
} ** {part = [] ; vtype = VAct ; lock_V = <>} ;
|
||||
} ** {part = [] ; vtype = VAct ; isVaere = False ; lock_V = <>} ;
|
||||
|
||||
mk2V a b = regVerb a b ** {part = [] ; vtype = VAct ; lock_V = <>} ;
|
||||
mk2V a b = regVerb a b ** {part = [] ; vtype = VAct ; isVaere = False ; lock_V = <>} ;
|
||||
|
||||
irregV =
|
||||
\drikke,drakk,drukket ->
|
||||
@@ -380,10 +387,17 @@ oper
|
||||
in
|
||||
mkV drikke drikker (drikke + "s") drakk drukket drikk ;
|
||||
|
||||
vaereV v = {
|
||||
s = v.s ;
|
||||
part = [] ;
|
||||
vtype = v.vtype ;
|
||||
isVaere = True ;
|
||||
lock_V = <>
|
||||
} ;
|
||||
|
||||
partV v p = {s = v.s ; part = p ; vtype = v.vtype ; lock_V = <>} ;
|
||||
depV v = {s = v.s ; part = v.part ; vtype = VPass ; lock_V = <>} ;
|
||||
reflV v = {s = v.s ; part = v.part ; vtype = VRefl ; lock_V = <>} ;
|
||||
partV v p = {s = v.s ; part = p ; vtype = v.vtype ; isVaere = v.isVaere ; lock_V = <>} ;
|
||||
depV v = {s = v.s ; part = v.part ; vtype = VPass ; isVaere = False ; lock_V = <>} ;
|
||||
reflV v = {s = v.s ; part = v.part ; vtype = VRefl ; isVaere = False ; lock_V = <>} ;
|
||||
|
||||
mkV2 v p = v ** {c2 = p ; lock_V2 = <>} ;
|
||||
dirV2 v = mkV2 v [] ;
|
||||
|
||||
@@ -79,16 +79,16 @@ concrete StructuralNor of Structural = CatNor **
|
||||
there7to_Adv = ss "dit" ;
|
||||
there7from_Adv = ss "derfra" ;
|
||||
therefore_PConj = ss "derfor" ;
|
||||
these_NP = regNP ["de her"] ["det hers"] Plg ;
|
||||
these_NP = regNP ["disse"] ["disses"] Plg ;
|
||||
they_Pron = MorphoNor.mkNP "de" "dem" "deres" "deres" "deres" Plg P1 ;
|
||||
this_Quant =
|
||||
{s = table {
|
||||
Sg => \\_ => genderForms ["den her"] ["det her"] ;
|
||||
Pl => \\_,_ => ["de her"]
|
||||
Sg => \\_ => genderForms ["denne"] ["dette"] ;
|
||||
Pl => \\_,_ => ["disse"]
|
||||
} ;
|
||||
det = DDef Indef
|
||||
det = DDef Def
|
||||
} ;
|
||||
this_NP = regNP ["det her"] ["det hers"] SgNeutr ;
|
||||
this_NP = regNP ["dette"] ["dettes"] SgNeutr ;
|
||||
those_NP = regNP ["de der"] ["de ders"] Plg ;
|
||||
through_Prep = ss "gjennom" ;
|
||||
too_AdA = ss "for" ;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
interface DiffScand = open CommonScand, Prelude in {
|
||||
|
||||
-- Parameters.
|
||||
--1 Differences between Scandinavian languages
|
||||
|
||||
-- Norway has three genders, Danish and Swedish have two.
|
||||
|
||||
param
|
||||
Gender ;
|
||||
@@ -14,13 +16,14 @@ interface DiffScand = open CommonScand, Prelude in {
|
||||
|
||||
detDef : Species ;
|
||||
|
||||
-- Danish verbs have a marking for compound-tense auxiliary ("have" or "være").
|
||||
-- Danish and Norwegian verbs, but not Swedish verbs,
|
||||
-- have two possible compound-tense auxiliaries ("have" or "være").
|
||||
|
||||
Verb : Type ;
|
||||
|
||||
hasAuxBe : Verb -> Bool ;
|
||||
|
||||
-- Strings.
|
||||
-- The rest of the parameters are function words used in the syntax modules.
|
||||
|
||||
conjThat : Str ;
|
||||
conjThan : Str ;
|
||||
|
||||
@@ -5,7 +5,7 @@ concrete IdiomSwe of Idiom = CatSwe **
|
||||
|
||||
lin
|
||||
ImpersCl vp = mkClause "det" (agrP3 neutrum Sg) vp ;
|
||||
GenericCl vp = mkClause "man" (agrP3 neutrum Sg) vp ;
|
||||
GenericCl vp = mkClause "man" (agrP3 utrum Sg) vp ;
|
||||
ExistNP np =
|
||||
mkClause "det" (agrP3 neutrum Sg) (insertObj
|
||||
(\\_ => np.s ! accusative) (predV (depV finna_V))) ;
|
||||
|
||||
@@ -231,8 +231,11 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com
|
||||
|
||||
CLinearize []
|
||||
| oElem showMulti opts ->
|
||||
changeArg (opTS2CommandArg (unlines. linearizeToAll
|
||||
(allStateGrammars st)) . s2t) sa
|
||||
|
||||
changeArg (opTS2CommandArg (
|
||||
unlines .
|
||||
(\t -> [optLinearizeTreeVal opts gr t | gr <- allStateGrammars st])) . s2t) sa
|
||||
|
||||
| otherwise -> changeArg (opTS2CommandArg (optLinearizeTreeVal opts gro) . s2t) sa
|
||||
---- CLinearize m -> changeArg (opTS2CommandArg (optLinearizeArgForm opts gro m)) sa
|
||||
|
||||
|
||||
@@ -185,11 +185,11 @@ txtHelpFile =
|
||||
"\n HINT: see GF language specification for the syntax of Pattern and Term." ++
|
||||
"\n You can also copy and past parsing results." ++
|
||||
"\n options: " ++
|
||||
"\n -table show parameters" ++
|
||||
"\n -struct bracketed form" ++
|
||||
"\n -record record, i.e. explicit GF concrete syntax term" ++
|
||||
"\n -all show all forms and variants" ++
|
||||
"\n -multi linearize to all languages (the other options don't work)" ++
|
||||
"\n -table show parameters (not compatible with -record, -all)" ++
|
||||
"\n -record record, i.e. explicit GF concrete syntax term (not compatible with -table, -all)" ++
|
||||
"\n -all show all forms and variants (not compatible with -record, -table)" ++
|
||||
"\n -multi linearize to all languages (can be combined with the other options)" ++
|
||||
"\n flags:" ++
|
||||
"\n -lang linearize in this grammar" ++
|
||||
"\n -number give this number of forms at most" ++
|
||||
@@ -243,6 +243,9 @@ txtHelpFile =
|
||||
"\n options:" ++
|
||||
"\n -c compare to existing xml-formatted treebank" ++
|
||||
"\n -trees return the trees of the treebank" ++
|
||||
"\n -all show all linearization alternatives (branches and variants)" ++
|
||||
"\n -table show tables of linearizations with parameters" ++
|
||||
"\n -record show linearization records" ++
|
||||
"\n -xml wrap the treebank (or comparison results) with XML tags" ++
|
||||
"\n -mem write the treebank in memory instead of a file TODO" ++
|
||||
"\n examples:" ++
|
||||
|
||||
@@ -186,7 +186,7 @@ optionsOfCommand co = case co of
|
||||
CGenerateRandom -> both "cf prob" "cat lang number depth atoms noexpand doexpand"
|
||||
CGenerateTrees -> both "metas" "atoms depth alts cat lang number noexpand doexpand"
|
||||
CPutTerm -> flags "transform number"
|
||||
CTreeBank -> opts "c xml trees"
|
||||
CTreeBank -> opts "c xml trees all table record"
|
||||
CLookupTreebank -> both "assocs raw strings trees" "treebank"
|
||||
CWrapTerm _ -> opts "c"
|
||||
CApplyTransfer _ -> flags "lang transfer"
|
||||
|
||||
@@ -30,7 +30,7 @@ module GF.UseGrammar.Treebank (
|
||||
) where
|
||||
|
||||
import GF.Compile.ShellState
|
||||
import GF.UseGrammar.Linear (linTree2string)
|
||||
import GF.UseGrammar.Linear -- (linTree2string)
|
||||
import GF.UseGrammar.Custom
|
||||
import GF.UseGrammar.GetTree (string2tree)
|
||||
import GF.Grammar.TypeCheck (annotate)
|
||||
@@ -38,7 +38,7 @@ import GF.Canon.CMacros (noMark)
|
||||
import GF.Grammar.Grammar (Trm)
|
||||
import GF.Grammar.MMacros (exp2tree)
|
||||
import GF.Grammar.Macros (zIdent)
|
||||
import GF.Grammar.PrGrammar (prt_)
|
||||
import GF.Grammar.PrGrammar (prt_,prt)
|
||||
import GF.Grammar.Values (tree2exp)
|
||||
import GF.Data.Operations
|
||||
import GF.Infra.Option
|
||||
@@ -47,6 +47,7 @@ import GF.Infra.UseIO
|
||||
import qualified GF.Grammar.Abstract as A
|
||||
import qualified Data.Map as M
|
||||
import qualified Data.Set as S
|
||||
import Control.Monad (liftM)
|
||||
|
||||
-- Generate a treebank with a multilingual grammar. AR 8/2/2006
|
||||
-- (c) Aarne Ranta 2006 under GNU GPL
|
||||
@@ -95,7 +96,7 @@ mkMultiTreebank opts sh com trees = putInXML opts "treebank" comm (concatMap mkI
|
||||
mkItem(t,i)= putInXML opts "item" (cat i) (mkTree t ++ concatMap (mkLin t) langs)
|
||||
-- mkItem(t,i)= putInXML opts "item" (cat i) (mkTree t >>mapM_ (mkLin t) langs)
|
||||
mkTree t = putInXML opts "tree" [] (puts $ showTree t)
|
||||
mkLin t lg = putInXML opts "lin" (lang lg) (puts $ linearize sh lg t)
|
||||
mkLin t lg = putInXML opts "lin" (lang lg) (puts $ linearize opts sh lg t)
|
||||
|
||||
langs = [prt_ l | l <- allLanguages sh]
|
||||
comm = "" --- " command=" ++ show com +++ "abstract=" ++ show abstr
|
||||
@@ -110,7 +111,7 @@ mkUniTreebank :: Options -> ShellState -> Language -> [A.Tree] -> Treebank
|
||||
mkUniTreebank opts sh lg trees = M.fromListWith (++) [(lin t, [prt_ t]) | t <- trees]
|
||||
where
|
||||
lang = prt_ lg
|
||||
lin t = linearize sh lang t
|
||||
lin t = linearize opts sh lang t
|
||||
|
||||
-- reads a treebank and linearizes its trees again, printing all differences
|
||||
testMultiTreebank :: Options -> ShellState -> String -> Res
|
||||
@@ -120,7 +121,7 @@ testMultiTreebank opts sh = putInXML opts "testtreebank" [] .
|
||||
where
|
||||
testOne (e,lang,str0) = do
|
||||
let tr = annot gr e
|
||||
let str = linearize sh lang tr
|
||||
let str = linearize opts sh lang tr
|
||||
if str == str0 then ret else putInXML opts "diff" [] $ concat [
|
||||
putInXML opts "tree" [] (puts $ showTree tr),
|
||||
putInXML opts "old" (" lang=" ++ show (prt_ (zIdent lang))) $ puts str0,
|
||||
@@ -198,11 +199,18 @@ tagXML s = "<" ++ s ++ ">"
|
||||
|
||||
--- these handy functions are borrowed from EmbedAPI
|
||||
|
||||
linearize mgr lang =
|
||||
untok .
|
||||
linTree2string noMark (canModules mgr) (zIdent lang)
|
||||
where
|
||||
sgr = stateGrammarOfLangOpt False mgr (zIdent lang)
|
||||
untok = customOrDefault (stateOptions sgr) useUntokenizer customUntokenizer sgr
|
||||
linearize opts mgr lang = lin where
|
||||
sgr = stateGrammarOfLangOpt False mgr zlang
|
||||
cgr = canModules mgr
|
||||
zlang = zIdent lang
|
||||
untok = customOrDefault (addOptions opts (stateOptions sgr)) useUntokenizer customUntokenizer sgr
|
||||
lin
|
||||
| oElem showRecord opts = err id id . liftM prt . linearizeNoMark cgr zlang
|
||||
| oElem tableLin opts =
|
||||
err id id . liftM (unlines . map untok . prLinTable True) . allLinTables cgr zlang
|
||||
| oElem showAll opts =
|
||||
err id id . liftM (unlines . map untok . prLinTable False) . allLinTables cgr zlang
|
||||
|
||||
| otherwise = untok . linTree2string noMark cgr zlang
|
||||
|
||||
showTree t = prt_ $ tree2exp t
|
||||
|
||||
11
src/HelpFile
11
src/HelpFile
@@ -156,11 +156,11 @@ l, linearize: l PattList? Tree
|
||||
HINT: see GF language specification for the syntax of Pattern and Term.
|
||||
You can also copy and past parsing results.
|
||||
options:
|
||||
-table show parameters
|
||||
-struct bracketed form
|
||||
-record record, i.e. explicit GF concrete syntax term
|
||||
-all show all forms and variants
|
||||
-multi linearize to all languages (the other options don't work)
|
||||
-table show parameters (not compatible with -record, -all)
|
||||
-record record, i.e. explicit GF concrete syntax term (not compatible with -table, -all)
|
||||
-all show all forms and variants (not compatible with -record, -table)
|
||||
-multi linearize to all languages (can be combined with the other options)
|
||||
flags:
|
||||
-lang linearize in this grammar
|
||||
-number give this number of forms at most
|
||||
@@ -214,6 +214,9 @@ tb, tree_bank: tb
|
||||
options:
|
||||
-c compare to existing xml-formatted treebank
|
||||
-trees return the trees of the treebank
|
||||
-all show all linearization alternatives (branches and variants)
|
||||
-table show tables of linearizations with parameters
|
||||
-record show linearization records
|
||||
-xml wrap the treebank (or comparison results) with XML tags
|
||||
-mem write the treebank in memory instead of a file TODO
|
||||
examples:
|
||||
|
||||
Reference in New Issue
Block a user