diff --git a/lectures/lecture-05/Agreement.gf b/lectures/lecture-05/Agreement.gf new file mode 100644 index 0000000..5baec8c --- /dev/null +++ b/lectures/lecture-05/Agreement.gf @@ -0,0 +1,13 @@ +abstract Agreement = { + cat + S ; + CN ; + V ; + N ; + A ; + Det ; + fun + PredVPS : CN -> V -> S ; -- the black cats run + DetCN : Det -> CN ; -- the black cat + AdjCN : N -> A -> CN ; -- black cats +} \ No newline at end of file diff --git a/lectures/lecture-05/MorphologyEng.gf b/lectures/lecture-05/MorphologyEng.gf new file mode 100644 index 0000000..7f9f7d8 --- /dev/null +++ b/lectures/lecture-05/MorphologyEng.gf @@ -0,0 +1,34 @@ +resource MorphologyEng = { + +param + Number = Sg | Pl ; + +oper + Noun : Type = {s : Number => Str} ; + + mkNoun : Str -> Str -> Noun = \sg, pl -> + {s = table {Sg => sg ; Pl => pl}} ; + + regNoun : Str -> Noun = \sg -> mkNoun sg (sg + "s") ; + + smartNoun : Str -> Noun = \sg -> case sg of { + _ + ("s" | "ch" | "sh") => mkNoun sg (sg + "es") ; + _ + ("ay" | "ey" | "oy" | "uy") => regNoun sg ; + x + "y" => mkNoun sg (x + "ies") ; + _ => regNoun sg + } ; + +-- to test + teacher_N : Noun = {s = table {Sg => "teacher" ; Pl => "teachers"}} ; + + cat_N : Noun = mkNoun "cat" "cats" ; + + dog_N : Noun = regNoun "dog" ; + + bus_N : Noun = smartNoun "bus" ; + baby_N : Noun = smartNoun "baby" ; + fly_N : Noun = smartNoun "fly" ; + + +} + diff --git a/lectures/lecture-05/MorphologySwe.gf b/lectures/lecture-05/MorphologySwe.gf new file mode 100644 index 0000000..da81cca --- /dev/null +++ b/lectures/lecture-05/MorphologySwe.gf @@ -0,0 +1,61 @@ +resource MorphologySwe = { + +param + Case = Nom | Gen ; + Definite = Ind | Def ; + Gender = Com | Neut ; + Number = Sg | Pl ; + + NForm = NF Number Definite Case ; -- NF is a constructor + +oper +-- Noun = {s : Number => Definite => Case => Str ; g : Gender} ; + Noun = {s : NForm => Str ; g : Gender} ; + + mkNoun : (sin, sig, sdn, sdg, pin, pig, pdn, pdg : Str) -> Gender -> Noun = + \sin, sig, sdn, sdg, pin, pig, pdn, pdg, g -> { + s = table { + NF Sg Ind Nom => sin ; + NF Sg Ind Gen => sig ; + NF Sg Def Nom => sdn ; + NF Sg Def Gen => sdg ; + NF Pl Ind Nom => pin ; + NF Pl Ind Gen => pig ; + NF Pl Def Nom => pdn ; + NF Pl Def Gen => pdg + } ; + g = g + } ; + + addS : Str -> Str = \s -> case s of { + _ + ("s" | "x" | "z") => s ; + _ => s + "s" + } ; + + mk4Noun : (sin, sdn, pin, pdn : Str) -> Noun = + \sin, sdn, pin, pdn -> { + s = table { + NF Sg Ind Nom => sin ; + NF Sg Ind Gen => addS sin ; + NF Sg Def Nom => sdn ; + NF Sg Def Gen => addS sdn ; + NF Pl Ind Nom => pin ; + NF Pl Ind Gen => addS pin ; + NF Pl Def Nom => pdn ; + NF Pl Def Gen => addS pdn + } ; + g = case sdn of { + _ + "n" => Com ; + _ => Neut + } + } ; + + smartNoun : Str -> Noun = \mamma -> case mamma of { + mamm + "a" => mkNoun mamma (mamma + "s") (mamma + "n") (mamma + "ns") + (mamm + "or") (mamm + "ors") (mamm + "orna") (mamm + "ornas") + Com ; + bil => mkNoun bil (bil + "s") (bil + "en") (bil + "ens") + (bil + "ar") (bil + "ars") (bil + "arna") (bil + "arnas") Com + } ; + +} \ No newline at end of file diff --git a/lectures/lecture-05/examples.md b/lectures/lecture-05/examples.md new file mode 100644 index 0000000..ac68f95 --- /dev/null +++ b/lectures/lecture-05/examples.md @@ -0,0 +1,22 @@ +## Number agreement in NPs + +| Singular | Plural | +| --- | --- | +| black cat | black cats | +| musta kissa | __mustat__ kissat | +| gatto nero | gatti __neri__ | +| schwarze Katze | schwarze Katzen | +| chat noir | chats __noirs__ | +| μαύρη γάτα | __μαύρες__ γάτες | +| czarny kot | __czarne__ koty | +| gato negro | gatos __negros__ | +| pisică neagră | pisici __negre__ | +| svart katt | __svarta__ katter | +| zwarte kat | zwarte katten | +| gato preto | gatos __pretos__ | +| черная кошка | __черные__ кошки | + +## Number agreement in VPs + +- the black cat __runs__, the black cats __run__ +- den svarta katten springer, de svarta katter springer \ No newline at end of file