summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2010-04-28 20:37:51 +0000
committeraarne <aarne@chalmers.se>2010-04-28 20:37:51 +0000
commitf23a03125722896068c33c5478e426c019d3b80d (patch)
tree972570623d83f6ed2e876022e8afb65c82ae105f /examples
parent3148bc3d90abde36a3a4702829e18f640d521d5d (diff)
extended phrasebook for Swedish (almost complete)
Diffstat (limited to 'examples')
-rw-r--r--examples/phrasebook/Sentences.gf4
-rw-r--r--examples/phrasebook/SentencesI.gf29
-rw-r--r--examples/phrasebook/Words.gf69
-rw-r--r--examples/phrasebook/WordsSwe.gf75
4 files changed, 124 insertions, 53 deletions
diff --git a/examples/phrasebook/Sentences.gf b/examples/phrasebook/Sentences.gf
index a9f0a7684..1f32b9d22 100644
--- a/examples/phrasebook/Sentences.gf
+++ b/examples/phrasebook/Sentences.gf
@@ -61,6 +61,8 @@ abstract Sentences = Numeral ** {
PCitizenship : Citizenship -> Phrase ;
PCountry : Country -> Phrase ;
PDay : Day -> Phrase ;
+ PByTransport : ByTransport -> Phrase ;
+ PTransport : Transport -> Phrase ;
PYes, PNo : Phrase ;
@@ -130,5 +132,7 @@ abstract Sentences = Numeral ** {
ACitizen : Person -> Citizenship -> Action ; -- you are Swedish
ABePlace : Person -> Place -> Action ; -- you are in the bar
+ ByTransp : Transport -> ByTransport ; -- by bus
+
}
diff --git a/examples/phrasebook/SentencesI.gf b/examples/phrasebook/SentencesI.gf
index 6d689d099..aaf7bcfa6 100644
--- a/examples/phrasebook/SentencesI.gf
+++ b/examples/phrasebook/SentencesI.gf
@@ -35,7 +35,7 @@ incomplete concrete SentencesI of Sentences = Numeral **
Name = NP ;
Number = Card ;
ByTransport = Adv ;
- Transport = {name : NP ; by : Adv} ;
+ Transport = {name : CN ; by : Adv} ;
Superlative = Det ;
lin
PSentence s = mkText s | lin Text (mkUtt s) ; -- optional '.'
@@ -53,7 +53,9 @@ incomplete concrete SentencesI of Sentences = Numeral **
PCountry x = mkPhrase (mkUtt x) ;
PCitizenship x = mkPhrase (mkUtt (mkAP x)) ;
PDay d = mkPhrase (mkUtt d.name) ;
-
+ PTransport t = mkPhrase (mkUtt t.name) ;
+ PByTransport t = mkPhrase (mkUtt t) ;
+
PYes = mkPhrase yes_Utt ;
PNo = mkPhrase no_Utt ;
@@ -88,18 +90,8 @@ incomplete concrete SentencesI of Sentences = Numeral **
Too property = mkAP too_AdA (mkAP property) ;
PropQuality property = mkAP property ;
- ThePlace kind =
- let name : NP = mkNP the_Quant kind.name in {
- name = name ;
- at = mkAdv kind.at name ;
- to = mkAdv kind.to name
- } ;
- APlace kind =
- let name : NP = mkNP a_Quant kind.name in {
- name = name ;
- at = mkAdv kind.at name ;
- to = mkAdv kind.to name
- } ;
+ ThePlace kind = placeNP the_Det kind ;
+ APlace kind = placeNP a_Det kind ;
IMale, IFemale = mkPerson i_Pron ;
YouFamMale, YouFamFemale = mkPerson youSg_Pron ;
@@ -123,7 +115,7 @@ incomplete concrete SentencesI of Sentences = Numeral **
AHave p kind = mkCl p.name have_V2 (mkNP kind) ;
ACitizen p n = mkCl p.name n ;
ABePlace p place = mkCl p.name place.at ;
-
+ ByTransp t = t.by ;
oper
@@ -161,6 +153,13 @@ oper
to = t
} ;
+ placeNP : Det -> CNPlace -> NPPlace = \det,kind ->
+ let name : NP = mkNP det kind.name in {
+ name = name ;
+ at = mkAdv kind.at name ;
+ to = mkAdv kind.to name
+ } ;
+
NPPerson : Type = {name : NP ; isPron : Bool ; poss : Quant} ;
relativePerson : GNumber -> CN -> (Num -> NP -> CN -> NP) -> NPPerson -> NPPerson =
diff --git a/examples/phrasebook/Words.gf b/examples/phrasebook/Words.gf
index 086a19004..dfa35bc59 100644
--- a/examples/phrasebook/Words.gf
+++ b/examples/phrasebook/Words.gf
@@ -40,41 +40,43 @@ abstract Words = Sentences ** {
-- kinds of places
Airport : PlaceKind ;
+ AmusementPark : PlaceKind ;
+ Bank : PlaceKind ;
Bar : PlaceKind ;
+ Cafeteria : PlaceKind ;
+ Center : PlaceKind ;
Cinema : PlaceKind ;
Church : PlaceKind ;
+ Disco : PlaceKind ;
Hospital : PlaceKind ;
Hotel : PlaceKind ;
Museum : PlaceKind ;
Park : PlaceKind ;
+ Parking : PlaceKind ;
+ Pharmacy : PlaceKind ;
+ PostOffice : PlaceKind ;
+ Pub : PlaceKind ;
Restaurant : PlaceKind ;
School : PlaceKind ;
Shop : PlaceKind ;
Station : PlaceKind ;
+ Supermarket : PlaceKind ;
Theatre : PlaceKind ;
Toilet : PlaceKind ;
University : PlaceKind ;
+ Zoo : PlaceKind ;
-
CitRestaurant : Citizenship -> PlaceKind ;
- Parking : PlaceKind ;
- Supermarket : PlaceKind ;
- Pharmacy : PlaceKind ;
- Center : PlaceKind ;
- Cafeteria : PlaceKind ;
- Disco : PlaceKind ;
- Pub : PlaceKind ;
- AmusementPark : PlaceKind ;
-- currency units
DanishCrown : Currency ;
Dollar : Currency ;
- Euro : Currency ; -- Germany, France, Italy, Finland, Spain, Netherlands
+ Euro : Currency ; -- Germany, France, Italy, Finland, Spain, The Netherlands
Lei : Currency ; -- Romania
Leva : Currency ; -- Bulgaria
NorwegianCrown : Currency ;
- Ruble : Currency ; -- Russia
+ Rouble : Currency ; -- Russia
SwedishCrown : Currency ;
Zloty : Currency ; -- Poland
@@ -83,39 +85,34 @@ abstract Words = Sentences ** {
Belgian : Citizenship ;
Belgium : Country ;
+ Bulgarian : Nationality ;
+ Catalan : Nationality ;
+ Danish : Nationality ;
+ Dutch : Nationality ;
English : Nationality ;
Finnish : Nationality ;
Flemish : Language ;
French : Nationality ;
+ German : Nationality ;
Italian : Nationality ;
- Romanian : Nationality ;
- Swedish : Nationality ;
-
--- ** added
- Spanish : Nationality ;
Norwegian : Nationality ;
- Danish : Nationality ;
--- Dane : Citizenship ;
- Dutch : Nationality ;
Polish : Nationality ;
- Catalan : Language ; -- ???
- German : Nationality ;
+ Romanian : Nationality ;
Russian : Nationality ;
- Bulgarian : Nationality ;
-
-
+ Spanish : Nationality ;
+ Swedish : Nationality ;
-- means of transportation
- Train : Transport ;
+ Bike : Transport ;
Bus : Transport ;
- Plane : Transport ;
+ Car : Transport ;
Ferry : Transport ;
+ Plane : Transport ;
Subway : Transport ;
- Tram : Transport ;
Taxi : Transport ;
- Car : Transport ;
- Bike : Transport ;
+ Train : Transport ;
+ Tram : Transport ;
ByFoot : ByTransport ;
@@ -178,21 +175,21 @@ abstract Words = Sentences ** {
HowFar : Place -> Question ; -- how far is the zoo ?
HowFarFrom : Place -> Place -> Question ; -- how far is the center from the hotel ?
- HowFarFromBy : Place -> Place -> ByTransport -> Question ; -- how far is the airport from the hotel by taxi ?
- HowFarBy : Place -> Transport -> Question ; -- how far is the museum by bus ?
-
-
+ HowFarFromBy : Place -> Place -> ByTransport -> Question ;
+ -- how far is the airport from the hotel by taxi ?
+ HowFarBy : Place -> Transport -> Question ; -- how far is the museum by bus ?
WhichTranspPlace : Transport -> Place -> Question ; -- which bus goes to the hotel
IsTranspPlace : Transport -> Place -> Question ; -- is there a metro to the airport ?
- ByTransp : Transport -> ByTransport ; -- by bus
+
+-- modifiers of places
TheBest : Superlative ;
TheClosest : Superlative ;
TheCheapest : Superlative ;
+ TheMostExpensive : Superlative ;
+ TheMostPopular : Superlative ;
TheWorst : Superlative ;
- MostExpensive : Superlative ;
- MostPopular : Superlative ;
SuperlPlace : Superlative -> PlaceKind -> Place ; -- the best bar
diff --git a/examples/phrasebook/WordsSwe.gf b/examples/phrasebook/WordsSwe.gf
index abd665746..002befb08 100644
--- a/examples/phrasebook/WordsSwe.gf
+++ b/examples/phrasebook/WordsSwe.gf
@@ -1,4 +1,4 @@
--- (c) 2009 Aarne Ranta under LGPL
+-- (c) 2010 Aarne Ranta under LGPL
concrete WordsSwe of Words = SentencesSwe **
open SyntaxSwe, ParadigmsSwe, IrregSwe, (L = LexiconSwe), ExtraSwe, Prelude in {
@@ -38,20 +38,33 @@ concrete WordsSwe of Words = SentencesSwe **
-- places
Airport = mkPlace (mkN "flygplats" "flygplatser") "på" ;
+ AmusementPark = mkPlace (mkN "nöjespark" "nöjesparken") "i" ;
+ Bank = mkPlace (mkN "bank" "banker") "i" ;
Bar = mkPlace (mkN "bar" "barer") "i" ;
+ Cafeteria = mkPlace (mkN "café" "café") "på" ;
+ Center = mkPlace (mkN "innerstad" "innerstäder") "på" ; ----
Church = mkPlace (mkN "kyrka") "i" ;
Cinema = mkPlace (mkN "bio" "bio" "bion" "biona") "på" ; ---- ?
+ Disco = mkPlace (mkN "diskotek" "diskotek") "på" ;
Hospital = mkPlace (mkN "sjukhus" "sjukhus") "på" ;
Hotel = mkPlace (mkN "hotell" "hotell") "på" ;
Museum = mkPlace (mkN "museum" "museet" "museer" "museerna") "på" ;
Park = mkPlace (mkN "park" "parker") "i" ;
+ Parking = mkPlace (mkN "parkering") "på" ;
+ Pharmacy = mkPlace (mkN "apotek" "apotek") "i" ;
+ PostOffice = mkPlace (mkN "post" "poster") "på" ;
+ Pub = mkPlace (mkN "pub" "pubben") "på" ;
Restaurant = mkPlace (mkN "restaurang" "restauranger") "på" ;
Shop = mkPlace (mkN "affär" "affär") "i" ;
School = mkPlace (mkN "skola") "på" ;
Station = mkPlace (mkN "station" "stationer") "på" ;
+ Supermarket = mkPlace (mkN "snabbköp" "snabbköp") "på" ;
Theatre = mkPlace (mkN "teater" "teatrar") "på" ;
Toilet = mkPlace (mkN "toalett" "toaletter") "på" ;
University = mkPlace (mkN "universitet" "universitet") "på" ;
+ Zoo = mkPlace (mkN "djurpark" "djurparker") "i" ;
+
+ CitRestaurant cit = mkCNPlace (mkCN cit (mkN "restaurang" "restauranger")) on_Prep to_Prep ;
-- currencies
@@ -59,20 +72,47 @@ concrete WordsSwe of Words = SentencesSwe **
Dollar = mkCN (mkN "dollar" "dollar") ;
Euro = mkCN (mkN "euro" "euro") ;
Lei = mkCN (mkN "lei" "lei") ;
+ Leva = mkCN (mkN "leva" "leva") ;
+ NorwegianCrown = mkCN (mkA "norsk") (mkN "krona") | mkCN (mkN "krona") ;
+ Rouble = mkCN (mkN "rubel" "rubeln" "rubel" "rubeln") ; ---- ?
SwedishCrown = mkCN (mkA "svensk") (mkN "krona") | mkCN (mkN "krona") ;
+ Zloty = mkCN (mkN "zloty" "zloty") ;
-- nationalities
Belgian = mkA "belgisk" ;
Belgium = mkNP (mkPN "Belgien") ;
+ Bulgarian = mkNat "bulgarisk" "Bulgarien" ;
+ Catalan = mkNat "katalansk" "Katalonien" ;
+ Danish = mkNat "dansk" "Danmark" ;
+ Dutch = mkNat "nederländsk" "Nederländerna" ;
English = mkNat "engelsk" "England" ;
Finnish = mkNat "finsk" "Finland" ;
Flemish = mkNP (mkPN "flamländska") ;
- French = mkNat "fransk" "Frankrike" ;
+ French = mkNat "fransk" "Frankrike" ;
+ German = mkNat "tysk" "Tyskland" ;
Italian = mkNat "italiensk" "Italien" ;
+ Norwegian = mkNat "norsk" "Norge" ;
+ Polish = mkNat "polsk" "Polen" ;
Romanian = mkNat "rumänsk" "Rumänien" ;
+ Russian = mkNat "rysk" "Ryssland" ;
+ Spanish = mkNat "spansk" "Spanien" ;
Swedish = mkNat "svensk" "Sverige" ;
+-- means of transportation
+
+ Bike = mkTransport L.bike_N ;
+ Bus = mkTransport (mkN "bus" "bussar") ;
+ Car = mkTransport L.car_N ;
+ Ferry = mkTransport (mkN "färja") ;
+ Plane = mkTransport L.airplane_N ;
+ Subway = mkTransport (mkN "metro" "metron" "metro" "metrona") ; ----
+ Taxi = mkTransport (mkN "taxi" "taxin" "taxibilar" "taxibilarna") ; ----
+ Train = mkTransport (mkN "tåg" "tåg") ;
+ Tram = mkTransport (mkN "spårvagn") ;
+
+ ByFoot = ParadigmsSwe.mkAdv "till fots" ;
+
-- actions
AHasAge p num = mkCl p.name (mkNP num L.year_N) ;
@@ -144,6 +184,32 @@ concrete WordsSwe of Words = SentencesSwe **
Tomorrow = ParadigmsSwe.mkAdv "imorgon" ;
+-- transports
+
+ HowFar place = mkQS (mkQCl (ExtraSwe.IAdvAdv L.far_Adv) place.name) ;
+{-
+ HowFarFrom : Place -> Place -> Question ; -- how far is the center from the hotel ?
+ HowFarFromBy : Place -> Place -> ByTransport -> Question ;
+ -- how far is the airport from the hotel by taxi ?
+ HowFarBy : Place -> Transport -> Question ; -- how far is the museum by bus ?
+-}
+ WhichTranspPlace trans place =
+ mkQS (mkQCl (mkIP which_IDet trans.name) (mkVP (mkVP L.go_V) place.to)) ;
+
+ IsTranspPlace trans place =
+ mkQS (mkQCl (mkCl (mkCN trans.name place.to))) ;
+
+-- modifiers of places
+
+ TheBest = mkSuperl L.good_A ;
+ TheClosest = mkSuperl L.near_A ;
+ TheCheapest = mkSuperl (mkA "billig") ;
+ TheMostExpensive = mkSuperl (mkA "dyr") ;
+ TheMostPopular = mkSuperl (mkA "populär") ;
+ TheWorst = mkSuperl L.bad_A ;
+
+ SuperlPlace sup p = placeNP sup p ;
+
oper
mkNat : Str -> Str -> NPNationality = \nat,co ->
mkNPNationality (mkNP (mkPN (nat + "a"))) (mkNP (mkPN co)) (mkA nat) ;
@@ -162,5 +228,10 @@ concrete WordsSwe of Words = SentencesSwe **
xOf : GNumber -> N -> NPPerson -> NPPerson = \n,x,p ->
relativePerson n (mkCN x) (\a,b,c -> mkNP (GenNP b) a c) p ;
+ mkTransport : N -> {name : CN ; by : Adv} = \n -> {
+ name = mkCN n ;
+ by = SyntaxSwe.mkAdv with_Prep (mkNP n)
+ } ;
+ mkSuperl : A -> Det = \a -> mkDet the_Art (mkOrd a) ;
}