mirror of
https://github.com/GrammaticalFramework/comp-syntax-gu-mlt.git
synced 2026-02-08 22:41:05 -07:00
after lecture 5 (will finish AgreementSwe on Wednesday)
This commit is contained in:
@@ -7,12 +7,15 @@ abstract Agreement = {
|
||||
Det ;
|
||||
|
||||
fun
|
||||
DetCN : Det -> CN -> NP ; -- the black cat
|
||||
DetCN : Det -> CN -> NP ; -- this black cat
|
||||
AdjCN : A -> N -> CN ; -- black cat
|
||||
UseN : N -> CN ; -- cat
|
||||
|
||||
cat_N : N ;
|
||||
house_N : N ;
|
||||
black_A : A ;
|
||||
the_Sg : Det ;
|
||||
the_Pl : Det ;
|
||||
big_A : A ;
|
||||
-- simplification of pronouns just to make English interesting
|
||||
this_Det : Det ;
|
||||
these_Det : Det ;
|
||||
}
|
||||
32
lectures/lecture-05/AgreementEng.gf
Normal file
32
lectures/lecture-05/AgreementEng.gf
Normal file
@@ -0,0 +1,32 @@
|
||||
concrete AgreementEng of Agreement = open MorphologyEng in {
|
||||
lincat
|
||||
NP = {s: Str; n: Number} ;
|
||||
CN = Noun ;
|
||||
N = Noun ;
|
||||
A = {s: Str} ;
|
||||
Det = {s: Str; n: Number} ;
|
||||
|
||||
lin
|
||||
DetCN d cn = {
|
||||
s = d.s ++ (cn.s ! d.n) ;
|
||||
n = d.n ;
|
||||
} ;
|
||||
AdjCN a cn = {
|
||||
s = \\n => a.s ++ (cn.s ! n) ;
|
||||
} ;
|
||||
UseN n = n ;
|
||||
|
||||
cat_N = regNoun "cat" ;
|
||||
house_N = regNoun "house" ;
|
||||
black_A = {s = "black"} ;
|
||||
big_A = {s = "big"} ;
|
||||
this_Det = {
|
||||
s = "this";
|
||||
n = Sg ;
|
||||
} ;
|
||||
these_Det = {
|
||||
s = "these";
|
||||
n = Pl ;
|
||||
} ;
|
||||
|
||||
}
|
||||
39
lectures/lecture-05/AgreementSwe.gf
Normal file
39
lectures/lecture-05/AgreementSwe.gf
Normal file
@@ -0,0 +1,39 @@
|
||||
concrete AgreementSwe of Agreement = open MorphologySwe in {
|
||||
lincat
|
||||
NP = {s: Str; a: NPAgreement} ;
|
||||
CN = Noun ;
|
||||
N = Noun ;
|
||||
A = Adjective ;
|
||||
Det = {s : Gender => Str; n: Number;} ; -- and possible Definiteness
|
||||
|
||||
lin
|
||||
-- DetCN d cn = {
|
||||
-- s = d.s ++ (cn.s ! d.n) ;
|
||||
-- n = d.n ;
|
||||
-- } ;
|
||||
-- AdjCN a cn = {
|
||||
-- s = \\n => let agr ? ? cn.g = NPAgr in (a.s ! agr) ++ (cn.s ! n) ;
|
||||
-- } ;
|
||||
UseN n = n ;
|
||||
|
||||
cat_N = mk4Noun "katt" "katten" "katter" "katterna" ;
|
||||
house_N = mk4Noun "hus" "huset" "hus" "husen" ;
|
||||
black_A = mk3Adjective "svart" "svart" "svarta" ;
|
||||
big_A = mk3Adjective "stor" "stort" "stora" ;
|
||||
this_Det = {
|
||||
s = table {
|
||||
Com => "den här" ;
|
||||
Neut => "det här"
|
||||
} ;
|
||||
n = Sg ;
|
||||
d = Def ;
|
||||
} ;
|
||||
these_Det = {
|
||||
s = table {
|
||||
Com => "de här" ;
|
||||
Neut => "de här"
|
||||
};
|
||||
n = Pl ;
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -7,11 +7,14 @@ param
|
||||
Number = Sg | Pl ;
|
||||
|
||||
NForm = NF Number Definite Case ; -- NF is a constructor
|
||||
NPAgreement = NPAgr Number Definite Gender ;
|
||||
|
||||
oper
|
||||
-- Noun = {s : Number => Definite => Case => Str ; g : Gender} ;
|
||||
Noun = {s : NForm => Str ; g : Gender} ;
|
||||
|
||||
Adjective = { s: NPAgreement => Str } ;
|
||||
|
||||
mkNoun : (sin, sig, sdn, sdg, pin, pig, pdn, pdg : Str) -> Gender -> Noun =
|
||||
\sin, sig, sdn, sdg, pin, pig, pdn, pdg, g -> {
|
||||
s = table {
|
||||
@@ -32,6 +35,19 @@ oper
|
||||
_ => s + "s"
|
||||
} ;
|
||||
|
||||
mk3Adjective : (stor, stort, stora : Str) -> Adjective = \stor, stort, stora -> {
|
||||
s = table {
|
||||
NPAgr Sg Ind Com => stor ;
|
||||
NPAgr Sg Ind Neut => stort ;
|
||||
NPAgr Sg Def Com => stora ;
|
||||
NPAgr Sg Def Neut => stora ;
|
||||
NPAgr Pl Ind Com => stora ;
|
||||
NPAgr Pl Ind Neut => stora ;
|
||||
NPAgr Pl Def Com => stora ;
|
||||
NPAgr Pl Def Neut => stora
|
||||
}
|
||||
} ;
|
||||
|
||||
mk4Noun : (sin, sdn, pin, pdn : Str) -> Noun =
|
||||
\sin, sdn, pin, pdn -> {
|
||||
s = table {
|
||||
|
||||
@@ -15,3 +15,19 @@
|
||||
| zwarte kat | zwarte katten |
|
||||
| gato preto | gatos __pretos__ |
|
||||
| черная кошка | __черные__ кошки |
|
||||
|
||||
- these black cats - de här svarta katterna
|
||||
- these black houses - de här svarta husen
|
||||
- these cats - de här katterna
|
||||
- these houses - de här husen
|
||||
- this black cat - den här svarta katten
|
||||
- this black house - det här svarta huset
|
||||
- this cat - den här katten
|
||||
- this house - det här huset
|
||||
|
||||
- big cat(s) - stor katt / stora katten / stora katter / stora katterna
|
||||
- black cat(s) - svart katt / svarta katten / svarta katter / svarta katterna
|
||||
- big house(s) - stort hus / stora huset / stora hus / stora husen
|
||||
- black house(s) - svart hus / svarta huset / svarta hus / svarta husen
|
||||
- cat - katt
|
||||
- house - hus
|
||||
Reference in New Issue
Block a user