mirror of
https://github.com/GrammaticalFramework/comp-syntax-gu-mlt.git
synced 2026-02-09 06:41:07 -07:00
initial state for lecture 05
This commit is contained in:
34
lectures/lecture-05/MorphologyEng.gf
Normal file
34
lectures/lecture-05/MorphologyEng.gf
Normal file
@@ -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" ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user