mirror of
https://github.com/GrammaticalFramework/comp-syntax-gu-mlt.git
synced 2026-05-04 07:12:50 -06:00
most of the lecture 5 syntax
This commit is contained in:
@@ -3,12 +3,67 @@
|
|||||||
concrete MicroLangMyeng of MicroLang = open MicroResMyeng, Prelude in {
|
concrete MicroLangMyeng of MicroLang = open MicroResMyeng, Prelude in {
|
||||||
|
|
||||||
lincat
|
lincat
|
||||||
|
Utt = {s : Str} ;
|
||||||
|
S = {s : Str} ;
|
||||||
|
|
||||||
|
NP = {s : Case => Str ; n : Number} ;
|
||||||
|
VP = {s : Number => Str} ;
|
||||||
|
CN = {s : Number => Str} ;
|
||||||
|
Comp = {s : Str} ;
|
||||||
|
AP = {s : Str} ;
|
||||||
|
Det = {s : Str ; n : Number} ;
|
||||||
|
Prep = {s : Str} ;
|
||||||
|
Pron = {s : Case => Str ; n : Number} ;
|
||||||
|
|
||||||
V = Verb ;
|
V = Verb ;
|
||||||
V2 = Verb2 ;
|
V2 = Verb2 ;
|
||||||
A = Adjective ;
|
A = Adjective ;
|
||||||
N = Noun ;
|
N = Noun ;
|
||||||
Adv = Adverb ;
|
Adv = Adverb ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
UttS s = s ;
|
||||||
|
UttNP np = {s = np.s ! Nom} ;
|
||||||
|
|
||||||
|
PredVPS np vp = {s = np.s ! Nom ++ vp.s ! np.n} ;
|
||||||
|
|
||||||
|
-- Verb
|
||||||
|
UseV verb = {s = \\n => presentVerb verb n} ;
|
||||||
|
|
||||||
|
ComplV2 verb np = {s = \\n => presentVerb verb n ++ verb.prep ++ np.s ! Acc} ;
|
||||||
|
|
||||||
|
UseComp comp = {s = \\n => copula n ++ comp.s} ;
|
||||||
|
CompAP ap = ap ;
|
||||||
|
AdvVP vp adv = {s = \\n => vp.s ! n ++ adv.s} ;
|
||||||
|
|
||||||
|
-- Noun
|
||||||
|
DetCN det cn = {s = \\c => det.s ++ cn.s ! det.n ; n = det.n} ;
|
||||||
|
UsePron pron = pron ;
|
||||||
|
|
||||||
|
a_Det = {s = "a" ; n = Sg} ;
|
||||||
|
aPl_Det = {s = "" ; n = Pl} ;
|
||||||
|
the_Det = {s = "the" ; n = Sg} ;
|
||||||
|
thePl_Det = {s = "the" ; n = Pl} ;
|
||||||
|
UseN noun = noun ;
|
||||||
|
AdjCN ap cn = {s = \\n => ap.s ++ cn.s ! n} ;
|
||||||
|
|
||||||
|
-- Adjective
|
||||||
|
PositA adj = adj ;
|
||||||
|
|
||||||
|
{-
|
||||||
|
-- Adverb
|
||||||
|
PrepNP : Prep -> NP -> Adv ; -- in the house
|
||||||
|
|
||||||
|
-- Structural
|
||||||
|
in_Prep : Prep ;
|
||||||
|
on_Prep : Prep ;
|
||||||
|
with_Prep : Prep ;
|
||||||
|
-}
|
||||||
|
he_Pron = {s = table {Nom => "he" ; Acc => "him"} ; n = Sg} ;
|
||||||
|
she_Pron = {s = table {Nom => "she" ; Acc => "her"} ; n = Sg} ;
|
||||||
|
they_Pron = {s = table {Nom => "they" ; Acc => "them"} ; n = Pl} ;
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
---------------- Lexicon part -----------------------
|
---------------- Lexicon part -----------------------
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ param
|
|||||||
|
|
||||||
VerbForm = Inf | Pres3Sg | Past | PastPart | PresPart ;
|
VerbForm = Inf | Pres3Sg | Past | PastPart | PresPart ;
|
||||||
|
|
||||||
|
Case = Nom | Acc ;
|
||||||
|
|
||||||
oper
|
oper
|
||||||
Noun : Type = {s : Number => Str} ;
|
Noun : Type = {s : Number => Str} ;
|
||||||
|
|
||||||
@@ -68,7 +70,7 @@ oper
|
|||||||
Adverb : Type = {s : Str} ;
|
Adverb : Type = {s : Str} ;
|
||||||
|
|
||||||
Verb : Type = {s : VerbForm => Str} ;
|
Verb : Type = {s : VerbForm => Str} ;
|
||||||
|
|
||||||
-- constructor; worst case paradigm
|
-- constructor; worst case paradigm
|
||||||
mkVerb : (sing, sings, sang, sung, singing : Str) -> Verb
|
mkVerb : (sing, sings, sang, sung, singing : Str) -> Verb
|
||||||
= \sing, sings, sang, sung, singing -> {
|
= \sing, sings, sang, sung, singing -> {
|
||||||
@@ -112,4 +114,18 @@ oper
|
|||||||
|
|
||||||
Verb2 : Type = {s : VerbForm => Str ; prep : Str} ;
|
Verb2 : Type = {s : VerbForm => Str ; prep : Str} ;
|
||||||
|
|
||||||
|
-- auxiliary for syntax
|
||||||
|
presentVerb : Verb -> Number -> Str = \verb, n ->
|
||||||
|
case n of {
|
||||||
|
Sg => verb.s ! Pres3Sg ;
|
||||||
|
Pl => verb.s ! Inf
|
||||||
|
} ;
|
||||||
|
|
||||||
|
copula : Number -> Str = \n ->
|
||||||
|
case n of {
|
||||||
|
Sg => "is" ;
|
||||||
|
Pl => "are"
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user