diff --git a/lib/resource-1.0/api/Constructors.gf b/lib/resource-1.0/api/Constructors.gf index bce93ffb8..1a7300935 100644 --- a/lib/resource-1.0/api/Constructors.gf +++ b/lib/resource-1.0/api/Constructors.gf @@ -289,12 +289,14 @@ incomplete resource Constructors = open Grammar in { -- The verb can also be a copula ("be"), and the relevant argument is -- then the complement adjective or noun phrase. - mkVP : A -> VP ; -- 9. be warm - mkVP : AP -> VP ; -- 12. be very warm - mkVP : N -> VP ; -- 13. be a man - mkVP : CN -> VP ; -- 14. be an old man - mkVP : NP -> VP ; -- 15. be the man - mkVP : Adv -> VP ; -- 16. be here + mkVP : A -> VP ; -- 9. be warm + mkVP : AP -> VP ; -- 12. be very warm + mkVP : A -> NP -> VP ; -- 10. be older than her + mkVP : A2 -> NP -> VP ; -- 11. be married to her + mkVP : N -> VP ; -- 13. be a man + mkVP : CN -> VP ; -- 14. be an old man + mkVP : NP -> VP ; -- 15. be the man + mkVP : Adv -> VP ; -- 16. be here -- A verb phrase can be modified with a postverbal or a preverbal adverb. @@ -340,43 +342,44 @@ incomplete resource Constructors = open Grammar in { -- special case of a simple common noun ($N$) is always provided. mkNP : overload { - mkNP : Det -> CN -> NP ; -- the first old man - mkNP : Det -> N -> NP ; -- the first man - mkNP : QuantSg -> CN -> NP ; -- this old man - mkNP : QuantSg -> N -> NP ; -- this man - mkNP : QuantPl -> CN -> NP ; -- these old men - mkNP : QuantPl -> N -> NP ; -- these men - mkNP : Numeral -> CN -> NP ; -- forty-five old men - mkNP : Numeral -> N -> NP ; -- forty-five men - mkNP : Int -> CN -> NP ; -- 45 old men - mkNP : Int -> N -> NP ; -- 45 men - mkNP : Num -> CN -> NP ; -- almost forty-five old men - mkNP : Num -> N -> NP ; -- almost forty-five men - mkNP : Pron -> CN -> NP; -- my old man - mkNP : Pron -> N -> NP ; -- my man + mkNP : Det -> N -> NP ; -- 1. the first man + mkNP : Det -> CN -> NP ; -- 2. the first old man + mkNP : QuantSg -> N -> NP ; -- 3. this man + mkNP : QuantSg -> CN -> NP ; -- 4. this old man + mkNP : QuantPl -> N -> NP ; -- 5. these men + mkNP : QuantPl -> CN -> NP ; -- 6. these old men + mkNP : Numeral -> N -> NP ; -- 7. twenty men + mkNP : Numeral -> CN -> NP ; -- 8. twenty old men + mkNP : Int -> N -> NP ; -- 9. 45 men + mkNP : Int -> CN -> NP ; -- 10. 45 old men + mkNP : Num -> N -> NP ; -- 11. almost twenty men + mkNP : Num -> CN -> NP ; -- 12. almost twenty old men + mkNP : Pron -> N -> NP ; -- 13. my man + mkNP : Pron -> CN -> NP; -- 14. my old man -- Proper names and pronouns can be used as noun phrases. - mkNP : PN -> NP ; -- John - mkNP : Pron -> NP ; -- he + mkNP : PN -> NP ; -- 15. John + mkNP : Pron -> NP ; -- 16. he -- A noun phrase once formed can be prefixed by a predeterminer and -- suffixed by a past participle or an adverb. - mkNP : Predet -> NP -> NP ; -- only John - mkNP : NP -> V2 -> NP ; -- the number squared - mkNP : NP -> Adv -> NP ; -- Paris at midnight + mkNP : Predet -> NP -> NP ; -- 17. only John + mkNP : NP -> V2 -> NP ; -- 18. John killed + mkNP : NP -> Adv -> NP ; -- 19. John in Paris -- A conjunction can be formed both from two noun phrases and a longer -- list of them. - mkNP : Conj -> NP -> NP -> NP ; -- John and Mary - mkNP : DConj -> NP -> NP -> NP ; -- both John and Mary - mkNP : Conj -> ListNP -> NP ; -- John, Mary, and Bill - mkNP : DConj -> ListNP -> NP -- both John, Mary, and Bill + mkNP : Conj -> NP -> NP -> NP ; -- 20. John and I + mkNP : Conj -> ListNP -> NP ; -- 21. John, I, and that + mkNP : DConj -> NP -> NP -> NP ; -- 22. either John or I + mkNP : DConj -> ListNP -> NP -- 23. either John, I, or that } ; + --3 Det, determiners -- A determiner is either a singular or a plural one. @@ -1362,7 +1365,11 @@ incomplete resource Constructors = open Grammar in { mkVP : V2A -> NP -> AP -> VP -- paint the house red = ComplV2A ; mkVP : A -> VP -- be warm - = \a -> UseComp (CompAP (PositA a)) ; + = \a -> UseComp (CompAP (PositA a)) ; + mkVP : A -> NP -> VP -- John is warmer than Mary + = \y,z -> (UseComp (CompAP (ComparA y z))) ; + mkVP : A2 -> NP -> VP -- John is married to Mary + = \y,z -> (UseComp (CompAP (ComplA2 y z))) ; mkVP : AP -> VP -- be warm = \a -> UseComp (CompAP a) ; mkVP : NP -> VP -- be a man @@ -1409,5 +1416,19 @@ incomplete resource Constructors = open Grammar in { } ; + mkInt : Str -> {s : Str ; size : Predef.Ints 1 ; last : Predef.Ints 9 ; lock_Int : {}} = \s -> { + s = s ; + last = case s of { + _ + "0" => 0 ; + _ + "1" => 1 ; + _ + "2" => 2 ; + _ => 3 ---- + } ; + size = case s of { + "1" => 0 ; + _ => 1 + } ; + lock_Int = <> + } ; } diff --git a/lib/resource-1.0/api/examples/Exx.gf b/lib/resource-1.0/api/examples/Exx.gf index 829c49793..e09e9ff0c 100644 --- a/lib/resource-1.0/api/examples/Exx.gf +++ b/lib/resource-1.0/api/examples/Exx.gf @@ -1,4 +1,6 @@ -abstract Exx = Cat ** { +abstract Exx = Cat-[VP] ** { + +cat VP ; --- hack to circumvent missing lockfields in overload resolution fun @@ -22,6 +24,10 @@ fun ex11_VP, ex12_VP, ex13_VP, ex14_VP, ex15_VP, ex16_VP, ex17_VP, ex18_VP, ex19_VP, ex20_VP, ex21_VP, ex22_VP : VP ; + ex1_NP, ex2_NP, ex3_NP, ex4_NP, ex5_NP, ex6_NP, ex7_NP, ex8_NP, ex9_NP, ex10_NP, + ex11_NP, ex12_NP, ex13_NP, ex14_NP, ex15_NP, ex16_NP, ex17_NP, ex18_NP, ex19_NP, ex20_NP, + ex21_NP, ex22_NP, ex23_NP : NP ; + -- auxiliary to show VP's diff --git a/lib/resource-1.0/api/examples/ExxEng.gf b/lib/resource-1.0/api/examples/ExxEng.gf index 15cf61ab3..8bd0a7811 100644 --- a/lib/resource-1.0/api/examples/ExxEng.gf +++ b/lib/resource-1.0/api/examples/ExxEng.gf @@ -1,6 +1,6 @@ --# -path=.:..:alltenses:prelude -concrete ExxEng of Exx = CatEng ** ExxI with +concrete ExxEng of Exx = CatEng-[VP] ** ExxI with (Lang = LangEng), (Constructors = ConstructorsEng) ; diff --git a/lib/resource-1.0/api/examples/ExxFre.gf b/lib/resource-1.0/api/examples/ExxFre.gf new file mode 100644 index 000000000..b44572b1b --- /dev/null +++ b/lib/resource-1.0/api/examples/ExxFre.gf @@ -0,0 +1,7 @@ +--# -path=.:..:alltenses:prelude + +concrete ExxFre of Exx = CatFre-[VP] ** ExxI with + (Lang = LangFre), + (Constructors = ConstructorsFre) ; + + diff --git a/lib/resource-1.0/api/examples/ExxI.gf b/lib/resource-1.0/api/examples/ExxI.gf index 223d918f0..cf8dcb636 100644 --- a/lib/resource-1.0/api/examples/ExxI.gf +++ b/lib/resource-1.0/api/examples/ExxI.gf @@ -1,7 +1,9 @@ -incomplete concrete ExxI of Exx = Cat ** open Lang, Constructors in { +incomplete concrete ExxI of Exx = Cat-[VP] ** open Lang, Constructors in { -- examples for Constructors. + lincat VP = Lang.VP ; --- hack to circumvent missing lockfields in overload resolution + lin ex1_Text = mkText (mkPhr but_PConj (mkUtt (mkCl john_NP walk_V))) ; ex2_Text = mkText (mkPhr (mkCl john_NP walk_V)) questMarkPunct (mkText yes_Phr) ; @@ -79,8 +81,8 @@ incomplete concrete ExxI of Exx = Cat ** open Lang, Constructors in { ex8_VP = mkVP paint_V2A (mkNP it_Pron) (mkAP red_A) ; ex9_VP = mkVP old_A ; ---- ex10_VP = mkVP old_A (mkNP she_Pron) ; ---- ex11_VP = mkVP married_A2 (mkNP she_Pron) ; + ex10_VP = mkVP old_A (mkNP she_Pron) ; + ex11_VP = mkVP married_A2 (mkNP she_Pron) ; ex12_VP = mkVP (mkAP very_AdA (mkAP old_A)) ; ex13_VP = mkVP man_N ; @@ -94,9 +96,33 @@ incomplete concrete ExxI of Exx = Cat ** open Lang, Constructors in { ex21_VP = passiveVP love_V2 (mkNP she_Pron) ; ex22_VP = progressiveVP (mkVP sleep_V) ; + ex1_NP = mkNP (mkDet (mkQuantSg defQuant) first_Ord) man_N ; + ex2_NP = mkNP (mkDet (mkQuantSg defQuant) first_Ord) (mkCN old_A man_N) ; + ex3_NP = mkNP (mkQuantSg this_Quant) man_N ; + ex4_NP = mkNP (mkQuantSg this_Quant) (mkCN old_A man_N) ; + ex5_NP = mkNP (mkQuantPl this_Quant) man_N ; + ex6_NP = mkNP (mkQuantPl this_Quant) (mkCN old_A man_N) ; + ex7_NP = mkNP n20_Numeral man_N ; + ex8_NP = mkNP n20_Numeral (mkCN old_A man_N) ; +--- ex9_NP = mkNP (mkInt "45") man_N ; +--- ex10_NP = mkNP (mkInt "45") (mkCN old_A man_N) ; + ex11_NP = mkNP (mkNum almost_AdN (mkNum n20_Numeral)) man_N ; + ex12_NP = mkNP (mkNum almost_AdN (mkNum n20_Numeral)) (mkCN old_A man_N) ; + ex13_NP = mkNP i_Pron man_N ; + ex14_NP = mkNP i_Pron (mkCN old_A man_N) ; + ex15_NP = mkNP john_PN ; + ex16_NP = mkNP i_Pron ; + ex17_NP = mkNP only_Predet john_NP ; + ex18_NP = mkNP john_NP kill_V2 ; + ex19_NP = mkNP john_NP (mkAdv in_Prep (mkNP paris_PN)) ; + ex20_NP = mkNP and_Conj john_NP (mkNP i_Pron) ; + ex21_NP = mkNP and_Conj (mkListNP john_NP (mkListNP (mkNP i_Pron) that_NP)) ; + ex22_NP = mkNP either7or_DConj john_NP (mkNP i_Pron) ; + ex23_NP = mkNP either7or_DConj (mkListNP john_NP (mkListNP (mkNP i_Pron) that_NP)) ; ---- utt u = mkUtt u ; + + utt u = mkUtt u ; -- a hack to linearize VPs oper john_PN = paris_PN ; ---- diff --git a/lib/resource-1.0/api/examples/ExxSwe.gf b/lib/resource-1.0/api/examples/ExxSwe.gf index 578e86160..ce3fdc5fe 100644 --- a/lib/resource-1.0/api/examples/ExxSwe.gf +++ b/lib/resource-1.0/api/examples/ExxSwe.gf @@ -1,6 +1,6 @@ --# -path=.:..:alltenses:prelude -concrete ExxSwe of Exx = CatSwe ** ExxI with +concrete ExxSwe of Exx = CatSwe-[VP] ** ExxI with (Lang = LangSwe), (Constructors = ConstructorsSwe) ; diff --git a/lib/resource-1.0/api/examples/mkgfs.hs b/lib/resource-1.0/api/examples/mkgfs.hs index 5d4bb6ece..06434a360 100644 --- a/lib/resource-1.0/api/examples/mkgfs.hs +++ b/lib/resource-1.0/api/examples/mkgfs.hs @@ -13,7 +13,7 @@ mkgfs = do addLin s = case words s of c@('e':'x':_):_ -> appendFile script ("l " ++ cc ++ "\n") where cc = case take 2 (reverse c) of - --- "PV" -> "utt " ++ c + "PV" -> "utt " ++ c _ -> c _ -> return ()