forked from GitHub/comp-syntax-gu-mlt
WIP lab 1
This commit is contained in:
1 parent
f1bf418200
commit
5b905390b6
43 files changed
+5
-330
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+5
-11
@@ -1,24 +1,18 @@
|
||||
# Lab 2: Multilingual generation and translation
|
||||
# Lab 1: Multilingual generation and translation
|
||||
|
||||
This lab corresponds to Chapters 5 to 9 of the Notes, but follows them only loosely.
|
||||
Therefore we will structure it according to the exercise sessions
|
||||
rather than chapters.
|
||||
In this lab, you will implement the concrete syntax of a grammar for a language of your choice.
|
||||
The abstract syntax is given in the directory [`../grammar/abstract/`](../grammar/abstract/) and an example concrete syntax for English can be found in [`../grammar/english/`](../grammar/english/).
|
||||
|
||||
The abstract syntax is given in the subdirectory grammars/abstract/
|
||||
## Part 1: design the morphological types of the major parts of speech in your selected language
|
||||
1. Go to [universaldependencies.org](https://universaldependencies.org/) and download Version 2.7+ treebanks
|
||||
2. Look up the Parallel UD treebanks for those 21 languages that have it. They are named e.g. `UD_English-PUD/`
|
||||
3. Select a language to compare with English.
|
||||
4. Make statistics about the frequencies of POS tags and dependency labels in your language compared with English: find the top-20 tags/labels and their number of occurrences. What does this tell you about the language? (This can be done with shell or Python programming or, more easily, with the [deptreepy](https://github.com/aarneranta/deptreepy/) or [gf-ud](https://github.com/grammaticalFramework/gf-ud) tools. The latter is also available on the eduserv server.)
|
||||
|
||||
1. Draw word alignments for some non-trivial example in the PUD treebank, on paper.
|
||||
Use the same trees as in the previous question.
|
||||
What can you say about the syntactic differences between the languages?
|
||||
|
||||
## Chapter 2: design the morpological types of the major parts of speech in your selected language
|
||||
|
||||
1. It is enough to cover NOUN, ADJ, and VERB.
|
||||
2. Use a traditional grammar book or a Wikipedia article to identify the inflectional and inherent features.
|
||||
3. Then use data from PUD to check which morphological features actually occur in the treebank for that language.
|
||||
|
||||
## After lecture 6
|
||||
|
||||
1. Design a morphology for the main lexical types (N, A, V) with parameters and a couple of paradigms.
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
abstract Doctor = {
|
||||
|
||||
flags startcat = Phrase ;
|
||||
|
||||
cat
|
||||
Phrase ; -- has she slept?
|
||||
Fact ; -- she sleeps
|
||||
Action ; -- sleep
|
||||
Property ; -- be a doctor
|
||||
Profession ; -- doctor
|
||||
Person ; -- she
|
||||
Place ; -- the hospital
|
||||
Substance ; -- drugs
|
||||
Illness ; -- fever
|
||||
|
||||
fun
|
||||
presPosPhrase : Fact -> Phrase ; -- she sleeps
|
||||
presNegPhrase : Fact -> Phrase ; -- she doesn't sleep
|
||||
pastPosPhrase : Fact -> Phrase ; -- she has slept
|
||||
pastNegPhrase : Fact -> Phrase ; -- she has not slept
|
||||
presQuestionPhrase : Fact -> Phrase ; -- does she sleep
|
||||
pastQuestionPhrase : Fact -> Phrase ; -- has she slept
|
||||
|
||||
impPosPhrase : Action -> Phrase ; -- eat
|
||||
impNegPhrase : Action -> Phrase ; -- don't eat
|
||||
|
||||
actionFact : Person -> Action -> Fact ; -- she vaccinates you
|
||||
propertyFact : Person -> Property -> Fact ; -- she is a doctor
|
||||
|
||||
isProfessionProperty : Profession -> Property ; -- be a doctor
|
||||
isAtPlaceProperty : Place -> Property ; -- be at the hospital
|
||||
haveIllnessProperty : Illness -> Property ; -- have a fever
|
||||
needProfessionProperty : Profession -> Property ; -- need a doctor
|
||||
|
||||
theProfessionPerson : Profession -> Person ; -- the doctor
|
||||
|
||||
iMascPerson : Person ;
|
||||
iFemPerson : Person ;
|
||||
youMascPerson : Person ;
|
||||
youFemPerson : Person ;
|
||||
hePerson : Person ;
|
||||
shePerson : Person ;
|
||||
|
||||
goToAction : Place -> Action ; -- go to the hospital
|
||||
stayAtAction : Place -> Action ; -- stay at home
|
||||
vaccinateAction : Person -> Action ; -- vaccinate you
|
||||
examineAction : Person -> Action ; -- examine you
|
||||
takeSubstanceAction : Substance -> Action ; -- take drugs
|
||||
|
||||
coughAction : Action ;
|
||||
breatheAction : Action ;
|
||||
vomitAction : Action ;
|
||||
sleepAction : Action ;
|
||||
undressAction : Action ;
|
||||
dressAction : Action ;
|
||||
eatAction : Action ;
|
||||
drinkAction : Action ;
|
||||
smokeAction : Action ;
|
||||
measureTemperatureAction : Action ;
|
||||
measureBloodPressureAction : Action ;
|
||||
|
||||
hospitalPlace : Place ;
|
||||
homePlace : Place ;
|
||||
schoolPlace : Place ;
|
||||
workPlace : Place ;
|
||||
|
||||
doctorProfession : Profession ;
|
||||
nurseProfession : Profession ;
|
||||
interpreterProfession : Profession ;
|
||||
|
||||
bePregnantProperty : Property ;
|
||||
beIllProperty : Property ;
|
||||
beWellProperty : Property ;
|
||||
beDeadProperty : Property ;
|
||||
haveAllergiesProperty : Property ;
|
||||
havePainsProperty : Property ;
|
||||
haveChildrenProperty : Property ;
|
||||
|
||||
feverIllness : Illness ;
|
||||
fluIllness : Illness ;
|
||||
headacheIllness : Illness ;
|
||||
diarrheaIllness : Illness ;
|
||||
heartDiseaseIllness : Illness ;
|
||||
lungDiseaseIllness : Illness ;
|
||||
hypertensionIllness : Illness ;
|
||||
|
||||
alcoholSubstance : Substance ;
|
||||
medicineSubstance : Substance ;
|
||||
drugsSubstance : Substance ;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
concrete DoctorEng of Doctor =
|
||||
open
|
||||
SyntaxEng,
|
||||
ParadigmsEng,
|
||||
Prelude
|
||||
in {
|
||||
|
||||
-- application using standard RGL
|
||||
|
||||
lincat
|
||||
Phrase = Utt ;
|
||||
Fact = Cl ;
|
||||
Action = VP ;
|
||||
Property = VP ;
|
||||
Profession = CN ;
|
||||
Person = NP ;
|
||||
Place = {at,to : Adv} ;
|
||||
Substance = NP ;
|
||||
Illness = NP ;
|
||||
|
||||
lin
|
||||
presPosPhrase fact = mkUtt (mkS fact) ;
|
||||
presNegPhrase fact = mkUtt (mkS negativePol fact) ;
|
||||
pastPosPhrase fact = mkUtt (mkS anteriorAnt fact) ;
|
||||
pastNegPhrase fact = mkUtt (mkS anteriorAnt negativePol fact) ;
|
||||
presQuestionPhrase fact = mkUtt (mkQS (mkQCl fact)) ;
|
||||
pastQuestionPhrase fact = mkUtt (mkQS anteriorAnt (mkQCl fact)) ;
|
||||
|
||||
impPosPhrase action = mkUtt (mkImp action) ;
|
||||
impNegPhrase action = mkUtt negativePol (mkImp action) ;
|
||||
|
||||
actionFact person action = mkCl person action ;
|
||||
propertyFact person property = mkCl person property ;
|
||||
|
||||
isProfessionProperty profession = mkVP (mkNP a_Det profession) ;
|
||||
needProfessionProperty profession = mkVP need_V2 (mkNP a_Det profession) ;
|
||||
isAtPlaceProperty place = mkVP place.at ;
|
||||
haveIllnessProperty illness = mkVP have_V2 illness ;
|
||||
|
||||
theProfessionPerson profession = mkNP the_Det profession ;
|
||||
|
||||
iMascPerson = i_NP ;
|
||||
iFemPerson = i_NP ;
|
||||
youMascPerson = you_NP ;
|
||||
youFemPerson = you_NP ;
|
||||
hePerson = he_NP ;
|
||||
shePerson = she_NP ;
|
||||
|
||||
goToAction place = mkVP (mkVP go_V) place.to ;
|
||||
stayAtAction place = mkVP (mkVP stay_V) place.at ;
|
||||
vaccinateAction person = mkVP vaccinate_V2 person ;
|
||||
examineAction person = mkVP examine_V2 person ;
|
||||
takeSubstanceAction substance = mkVP take_V2 substance ;
|
||||
|
||||
-- end of what could be a functor
|
||||
--------------------------------
|
||||
|
||||
coughAction = mkVP (mkV "cough") ;
|
||||
breatheAction = mkVP (mkV "breathe") ;
|
||||
vomitAction = mkVP (mkV "vomit") ;
|
||||
sleepAction = mkVP (mkV "sleep" "slept" "slept") ;
|
||||
undressAction = mkVP (mkVP take_V2 (mkNP thePl_Det (mkN "clothe"))) (pAdv "off") ;
|
||||
dressAction = mkVP (mkVP put_V2 (mkNP thePl_Det (mkN "clothe"))) (pAdv "on") ;
|
||||
eatAction = mkVP (mkV "eat" "ate" "eaten") ;
|
||||
drinkAction = mkVP (mkV "drink" "drank" "drunk") ;
|
||||
smokeAction = mkVP (mkV "smoke") ;
|
||||
measureTemperatureAction = mkVP (mkV2 (mkV "measure")) (mkNP the_Det (mkN "body temperature")) ;
|
||||
measureBloodPressureAction = mkVP (mkV2 (mkV "measure")) (mkNP the_Det (mkN "blood pressure")) ;
|
||||
|
||||
hospitalPlace = {at = pAdv "at the hospital" ; to = pAdv "to the hospital"} ;
|
||||
homePlace = {at = pAdv "at home" ; to = pAdv "home"} ;
|
||||
schoolPlace = {at = pAdv "at school" ; to = pAdv "to school"} ;
|
||||
workPlace = {at = pAdv "at work" ; to = pAdv "to work"} ;
|
||||
|
||||
doctorProfession = mkCN (mkN "doctor") ;
|
||||
nurseProfession = mkCN (mkN "nurse") ;
|
||||
interpreterProfession = mkCN (mkN "interpreter") ;
|
||||
|
||||
bePregnantProperty = mkVP (mkA "pregnant") ;
|
||||
beIllProperty = mkVP (mkA "ill") ;
|
||||
beWellProperty = mkVP (mkA "well") ;
|
||||
beDeadProperty = mkVP (mkA "dead") ;
|
||||
haveAllergiesProperty = mkVP have_V2 (mkNP aPl_Det (mkN "allergy")) ;
|
||||
havePainsProperty = mkVP have_V2 (mkNP aPl_Det (mkN "pain")) ;
|
||||
haveChildrenProperty = mkVP have_V2 (mkNP aPl_Det (mkN "child" "children")) ;
|
||||
|
||||
feverIllness = mkNP a_Det (mkN "fever") ;
|
||||
fluIllness = mkNP a_Det (mkN "flu") ;
|
||||
headacheIllness = mkNP a_Det (mkN "headache") ;
|
||||
diarrheaIllness = mkNP a_Det (mkN "diarrhea") ;
|
||||
heartDiseaseIllness = mkNP a_Det (mkN "heart disease") ;
|
||||
lungDiseaseIllness = mkNP a_Det (mkN "lung disease") ;
|
||||
hypertensionIllness = mkNP (mkN "hypertension") ;
|
||||
|
||||
alcoholSubstance = mkNP (mkN "alcohol") ;
|
||||
medicineSubstance = mkNP a_Det (mkN "drug") ;
|
||||
drugsSubstance = mkNP aPl_Det (mkN "drug") ;
|
||||
|
||||
oper
|
||||
pAdv : Str -> Adv = ParadigmsEng.mkAdv ;
|
||||
|
||||
go_V = mkV "go" "went" "gone" ;
|
||||
stay_V = mkV "stay" ;
|
||||
need_V2 = mkV2 (mkV "need") ;
|
||||
take_V2 = mkV2 (mkV "take" "took" "taken") ;
|
||||
put_V2 = mkV2 (mkV "put" "put" "put") ;
|
||||
vaccinate_V2 = mkV2 (mkV "vaccinate") ;
|
||||
examine_V2 = mkV2 (mkV "examine") ;
|
||||
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
--# -path=.:../abstract:../english:../api
|
||||
|
||||
-- model implementation using Mini RGL
|
||||
|
||||
concrete DoctorMiniEng of Doctor =
|
||||
open
|
||||
MiniSyntaxEng,
|
||||
MiniParadigmsEng,
|
||||
Prelude
|
||||
in {
|
||||
|
||||
-- application using your own Mini* modules
|
||||
|
||||
lincat
|
||||
Phrase = Utt ;
|
||||
Fact = Cl ;
|
||||
Action = VP ;
|
||||
Property = VP ;
|
||||
Profession = CN ;
|
||||
Person = NP ;
|
||||
Place = {at,to : Adv} ;
|
||||
Substance = NP ;
|
||||
Illness = NP ;
|
||||
|
||||
lin
|
||||
presPosPhrase fact = mkUtt (mkS fact) ;
|
||||
presNegPhrase fact = mkUtt (mkS negativePol fact) ;
|
||||
pastPosPhrase fact = mkUtt (mkS anteriorAnt fact) ;
|
||||
pastNegPhrase fact = mkUtt (mkS anteriorAnt negativePol fact) ;
|
||||
-- presQuestionPhrase fact = mkUtt (mkQS (mkQCl fact)) ;
|
||||
-- pastQuestionPhrase fact = mkUtt (mkQS anteriorAnt (mkQCl fact)) ;
|
||||
presQuestionPhrase fact = let p : Utt = mkUtt (mkQS (mkQCl fact)) in p ** {s = p.s ++ SOFT_BIND ++ "?"} ;
|
||||
pastQuestionPhrase fact = let p : Utt = mkUtt (mkQS anteriorAnt (mkQCl fact)) in p ** {s = p.s ++ SOFT_BIND ++ "?"} ;
|
||||
|
||||
|
||||
impPosPhrase action = mkUtt (mkImp action) ;
|
||||
impNegPhrase action = mkUtt negativePol (mkImp action) ;
|
||||
|
||||
actionFact person action = mkCl person action ;
|
||||
propertyFact person property = mkCl person property ;
|
||||
|
||||
isProfessionProperty profession = mkVP (mkNP a_Det profession) ;
|
||||
needProfessionProperty profession = mkVP need_V2 (mkNP a_Det profession) ;
|
||||
isAtPlaceProperty place = mkVP place.at ;
|
||||
haveIllnessProperty illness = mkVP have_V2 illness ;
|
||||
|
||||
theProfessionPerson profession = mkNP the_Det profession ;
|
||||
|
||||
iMascPerson = i_NP ;
|
||||
iFemPerson = i_NP ;
|
||||
youMascPerson = you_NP ;
|
||||
youFemPerson = you_NP ;
|
||||
hePerson = he_NP ;
|
||||
shePerson = she_NP ;
|
||||
|
||||
goToAction place = mkVP (mkVP go_V) place.to ;
|
||||
stayAtAction place = mkVP (mkVP stay_V) place.at ;
|
||||
vaccinateAction person = mkVP vaccinate_V2 person ;
|
||||
examineAction person = mkVP examine_V2 person ;
|
||||
takeSubstanceAction substance = mkVP take_V2 substance ;
|
||||
|
||||
-- end of what could be a functor
|
||||
--------------------------------
|
||||
|
||||
coughAction = mkVP (mkV "cough") ;
|
||||
breatheAction = mkVP (mkV "breathe") ;
|
||||
vomitAction = mkVP (mkV "vomit") ;
|
||||
sleepAction = mkVP (mkV "sleep" "slept" "slept") ;
|
||||
undressAction = mkVP (mkVP take_V2 (mkNP thePl_Det (mkN "clothe"))) (pAdv "off") ;
|
||||
dressAction = mkVP (mkVP put_V2 (mkNP thePl_Det (mkN "clothe"))) (pAdv "on") ;
|
||||
eatAction = mkVP (mkV "eat" "ate" "eaten") ;
|
||||
drinkAction = mkVP (mkV "drink" "drank" "drunk") ;
|
||||
smokeAction = mkVP (mkV "smoke") ;
|
||||
measureTemperatureAction = mkVP (mkV2 (mkV "measure")) (mkNP the_Det (mkN "body temperature")) ;
|
||||
measureBloodPressureAction = mkVP (mkV2 (mkV "measure")) (mkNP the_Det (mkN "blood pressure")) ;
|
||||
|
||||
hospitalPlace = {at = pAdv "at the hospital" ; to = pAdv "to the hospital"} ;
|
||||
homePlace = {at = pAdv "at home" ; to = pAdv "home"} ;
|
||||
schoolPlace = {at = pAdv "at school" ; to = pAdv "to school"} ;
|
||||
workPlace = {at = pAdv "at work" ; to = pAdv "to work"} ;
|
||||
|
||||
doctorProfession = mkCN (mkN "doctor") ;
|
||||
nurseProfession = mkCN (mkN "nurse") ;
|
||||
interpreterProfession = mkCN (mkN "interpreter") ;
|
||||
|
||||
bePregnantProperty = mkVP (mkA "pregnant") ;
|
||||
beIllProperty = mkVP (mkA "ill") ;
|
||||
beWellProperty = mkVP (mkA "well") ;
|
||||
beDeadProperty = mkVP (mkA "dead") ;
|
||||
haveAllergiesProperty = mkVP have_V2 (mkNP aPl_Det (mkN "allergy")) ;
|
||||
havePainsProperty = mkVP have_V2 (mkNP aPl_Det (mkN "pain")) ;
|
||||
haveChildrenProperty = mkVP have_V2 (mkNP aPl_Det (mkN "child" "children")) ;
|
||||
|
||||
feverIllness = mkNP a_Det (mkN "fever") ;
|
||||
fluIllness = mkNP a_Det (mkN "flu") ;
|
||||
headacheIllness = mkNP a_Det (mkN "headache") ;
|
||||
diarrheaIllness = mkNP a_Det (mkN "diarrhea") ;
|
||||
heartDiseaseIllness = mkNP a_Det (mkN "heart disease") ;
|
||||
lungDiseaseIllness = mkNP a_Det (mkN "lung disease") ;
|
||||
hypertensionIllness = mkNP (mkN "hypertension") ;
|
||||
|
||||
alcoholSubstance = mkNP (mkN "alcohol") ;
|
||||
medicineSubstance = mkNP a_Det (mkN "drug") ;
|
||||
drugsSubstance = mkNP aPl_Det (mkN "drug") ;
|
||||
|
||||
oper
|
||||
pAdv : Str -> Adv = MiniParadigmsEng.mkAdv ;
|
||||
|
||||
go_V = mkV "go" "went" "gone" ;
|
||||
stay_V = mkV "stay" ;
|
||||
need_V2 = mkV2 (mkV "need") ;
|
||||
take_V2 = mkV2 (mkV "take" "took" "taken") ;
|
||||
put_V2 = mkV2 (mkV "put" "put" "put") ;
|
||||
vaccinate_V2 = mkV2 (mkV "vaccinate") ;
|
||||
examine_V2 = mkV2 (mkV "examine") ;
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user