diff --git a/examples/phrasebook/Implementation.html b/examples/phrasebook/Implementation.html index 7c737f99c..e6227956c 100644 --- a/examples/phrasebook/Implementation.html +++ b/examples/phrasebook/Implementation.html @@ -41,6 +41,9 @@ gfdoc - a rudimentary GF document generator. Date = Adv ; Name = NP ; Number = Card ; + ByTransport = Adv ; + Transport = {name : CN ; by : Adv} ; + Superlative = Det ; lin PSentence s = mkText s | lin Text (mkUtt s) ; -- optional '.' PQuestion s = mkText s | lin Text (mkUtt s) ; -- optional '?' @@ -57,6 +60,8 @@ gfdoc - a rudimentary GF document generator. 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 ; @@ -91,12 +96,9 @@ gfdoc - a rudimentary GF document generator. Very property = mkAP very_AdA (mkAP property) ; 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 - } ; + + ThePlace kind = placeNP the_Det kind ; + APlace kind = placeNP a_Det kind ; IMale, IFemale = mkPerson i_Pron ; YouFamMale, YouFamFemale = mkPerson youSg_Pron ; @@ -120,8 +122,10 @@ gfdoc - a rudimentary GF document generator. NNumeral n = mkCard <lin Numeral n : Numeral> ; AHave p kind = mkCl p.name have_V2 (mkNP kind) ; + AHaveCurr p curr = mkCl p.name have_V2 (mkNP aPl_Det curr) ; ACitizen p n = mkCl p.name n ; ABePlace p place = mkCl p.name place.at ; + ByTransp t = t.by ; oper @@ -161,6 +165,13 @@ These are used in Words for each language. 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 = @@ -242,20 +253,33 @@ also the directional preposition varies, but in English we use to, as defined by mkPlace.
       Airport = mkPlace "airport" "at" ;
+      AmusementPark = mkCompoundPlace "amusement" "park" "at" ;
+      Bank = mkPlace "bank" "at" ;
       Bar = mkPlace "bar" "in" ;
-      Church = mkPlace "church" "in" ;
+      Cafeteria = mkPlace "canteen" "in" ;
+      Center = mkPlace "center" "in" ;
       Cinema = mkPlace "cinema" "at" ;
+      Church = mkPlace "church" "in" ;
+      Disco = mkPlace "disco" "at" ;
       Hospital = mkPlace "hospital" "in" ;
       Hotel = mkPlace "hotel" "in" ;
-      Museum = mkPlace "museum" "in" ;
+      Museum = mkPlace "museum" "at" ;
       Park = mkPlace "park" "in" ;
+      Parking = mkCompoundPlace "car" "park" "in" ; 
+      Pharmacy = mkPlace "pharmacy" "at" ;
+      PostOffice = mkCompoundPlace "post" "office" "at" ;
+      Pub = mkPlace "pub" "at" ;
       Restaurant = mkPlace "restaurant" "in" ;
       School = mkPlace "school" "at" ;
-      Shop = mkPlace "shop" "in" ;
+      Shop = mkPlace "shop" "at" ;
       Station = mkPlace "station" "at" ;
+      Supermarket = mkPlace "supermarket" "at" ; 
       Theatre = mkPlace "theatre" "at" ;
       Toilet = mkPlace "toilet" "in" ;
       University = mkPlace "university" "at" ;
+      Zoo = mkPlace "zoo" "at" ;
+  
+      CitRestaurant cit = mkCNPlace (mkCN cit (mkN "restaurant")) in_Prep to_Prep ;
 
Currencies; crown is ambiguous between Danish and Swedish crowns. @@ -264,25 +288,54 @@ Currencies; crown is ambiguous between Danish and Swedish crowns. Dollar = mkCN (mkN "dollar") ; Euro = mkCN (mkN "euro" "euros") ; -- to prevent euroes Lei = mkCN (mkN "leu" "lei") ; + Leva = mkCN (mkN "lev") ; + NorwegianCrown = mkCN (mkA "Norwegian") (mkN "crown") | mkCN (mkN "crown") ; + Pound = mkCN (mkN "pound") ; + Rouble = mkCN (mkN "rouble") ; SwedishCrown = mkCN (mkA "Swedish") (mkN "crown") | mkCN (mkN "crown") ; + Zloty = mkCN (mkN "zloty" "zloty") ; Nationalities
       Belgian = mkA "Belgian" ;
       Belgium = mkNP (mkPN "Belgium") ;
+      Bulgarian = mkNat "Bulgarian" "Bulgaria" ;
+      Catalan = mkNPNationality (mkNP (mkPN "Catalan")) (mkNP (mkPN "Catalonia")) (mkA "Catalonian") ;
+      Danish = mkNat "Danish" "Denmark" ;
+      Dutch =  mkNPNationality (mkNP (mkPN "Dutch")) (mkNP the_Quant (mkN "Netherlands")) (mkA "Dutch") ;
       English = mkNat "English" "England" ;
       Finnish = mkNat "Finnish" "Finland" ;
       Flemish = mkNP (mkPN "Flemish") ;
       French = mkNat "French" "France" ; 
+      German = mkNat "German" "Germany" ;
       Italian = mkNat "Italian" "Italy" ;
+      Norwegian = mkNat "Norwegian" "Norway" ;
+      Polish = mkNat "Polish" "Poland" ;
       Romanian = mkNat "Romanian" "Romania" ;
+      Russian = mkNat "Russian" "Russia" ;
+      Spanish = mkNat "Spanish" "Spain" ;
       Swedish = mkNat "Swedish" "Sweden" ;
 
+Means of transportation +
+     Bike = mkTransport L.bike_N ;
+     Bus = mkTransport (mkN "bus") ;
+     Car = mkTransport L.car_N ;
+     Ferry = mkTransport (mkN "ferry") ;
+     Plane = mkTransport L.airplane_N ;
+     Subway = mkTransport (mkN "subway") ;
+     Taxi = mkTransport (mkN "taxi") ;
+     Train = mkTransport (mkN "train") ;
+     Tram = mkTransport (mkN "tram") ;
+  
+     ByFoot = P.mkAdv "by foot" ;
+
+ Actions: the predication patterns are very often language-dependent.
-      AHasAge p num = mkCl p.name (mkNP num L.year_N) ;
+      AHasAge p num = mkCl p.name (mkNP (mkDet num)) ;
       AHasChildren p num = mkCl p.name have_V2 (mkNP num L.child_N) ;
       AHasRoom p num = mkCl p.name have_V2 
         (mkNP (mkNP a_Det (mkN "room")) (SyntaxEng.mkAdv for_Prep (mkNP num (mkN "person")))) ;
@@ -324,8 +377,9 @@ miscellaneous
 Building phrases from strings is complicated: the solution is to use
 mkText : Text -> Text -> Text ;
 
-      PSeeYou d = mkText (lin Text (ss ("see you"))) (mkPhrase (mkUtt d)) ;
-      PSeeYouPlace p d = 
+      PSeeYouDate d = mkText (lin Text (ss ("see you"))) (mkPhrase (mkUtt d)) ;
+      PSeeYouPlace p = mkText (lin Text (ss ("see you"))) (mkPhrase (mkUtt p.at)) ;
+      PSeeYouPlaceDate p d = 
         mkText (lin Text (ss ("see you"))) 
           (mkText (mkPhrase (mkUtt p.at)) (mkPhrase (mkUtt d))) ;
 
@@ -354,6 +408,33 @@ week days Tomorrow = P.mkAdv "tomorrow" ;
+modifiers of places +
+      TheBest = mkSuperl L.good_A ;
+      TheClosest = mkSuperl L.near_A ; 
+      TheCheapest = mkSuperl (mkA "cheap") ;
+      TheMostExpensive = mkSuperl (mkA "expensive") ;
+      TheMostPopular = mkSuperl (mkA "popular") ;
+      TheWorst = mkSuperl L.bad_A ;
+  
+      SuperlPlace sup p = placeNP sup p ;
+
+ +transports +
+      HowFar place = mkQS (mkQCl far_IAdv place.name) ;
+      HowFarFrom x y = mkQS (mkQCl far_IAdv (mkNP y.name (SyntaxEng.mkAdv from_Prep x.name))) ;
+      HowFarFromBy x y t = 
+        mkQS (mkQCl far_IAdv (mkNP (mkNP y.name (SyntaxEng.mkAdv from_Prep x.name)) t)) ;
+      HowFarBy y t = mkQS (mkQCl far_IAdv (mkNP y.name t)) ;
+  
+      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))) ;
+
+ auxiliaries
     oper
@@ -366,6 +447,9 @@ auxiliaries
         mkNPDay day (SyntaxEng.mkAdv on_Prep day) 
           (SyntaxEng.mkAdv on_Prep (mkNP a_Quant plNum (mkCN (mkN d)))) ;
   
+      mkCompoundPlace : Str -> Str -> Str -> {name : CN ; at : Prep ; to : Prep} = \comp, p, i ->
+       mkCNPlace (mkCN (P.mkN comp (mkN p))) (P.mkPrep i) to_Prep ;
+  
       mkPlace : Str -> Str -> {name : CN ; at : Prep ; to : Prep} = \p,i -> 
         mkCNPlace (mkCN (mkN p)) (P.mkPrep i) to_Prep ;
   
@@ -377,6 +461,15 @@ auxiliaries
   
       nameOf : NPPerson -> NP = \p -> (xOf sing (mkN "name") p).name ;
   
+      mkTransport : N -> {name : CN ; by : Adv} = \n -> {
+        name = mkCN n ; 
+        by = SyntaxEng.mkAdv by8means_Prep (mkNP n)
+        } ;
+  
+      mkSuperl : A -> Det = \a -> SyntaxEng.mkDet the_Art (SyntaxEng.mkOrd a) ;
+  
+     far_IAdv = ExtraEng.IAdvAdv (ss "far") ;
+  
   }
 
diff --git a/examples/phrasebook/Ontology.html b/examples/phrasebook/Ontology.html index f318ed68a..098814653 100644 --- a/examples/phrasebook/Ontology.html +++ b/examples/phrasebook/Ontology.html @@ -45,6 +45,9 @@ are defined in other modules. Date ; -- definite date e.g. "on Friday" Name ; -- name of person e.g. "NN" Number ; -- number expression 1 .. 999,999 e.g. "twenty" + Transport ; -- transportation device e.g. "car" + ByTransport ; -- mean of transportation e.g. "by tram" + Superlative ; -- superlative modifiers of places e.g. "the best restaurant" Many of the categories are accessible as Phrases, i.e. as translation units. @@ -65,6 +68,8 @@ Many of the categories are accessible as Phrases, i.e. as translation units. PCitizenship : Citizenship -> Phrase ; PCountry : Country -> Phrase ; PDay : Day -> Phrase ; + PByTransport : ByTransport -> Phrase ; + PTransport : Transport -> Phrase ; PYes, PNo : Phrase ; @@ -110,7 +115,8 @@ Determiners. AmountCurrency : Number -> Currency -> Price ; -- five euros - ThePlace : PlaceKind -> Place ; -- the bar + ThePlace : PlaceKind -> Place ; -- the bar + APlace : PlaceKind -> Place ; -- a bar IMale, IFemale, -- I, said by man/woman (affects agreement) YouFamMale, YouFamFemale, -- familiar you, said to man/woman (affects agreement) @@ -135,9 +141,12 @@ Determiners. Actions are typically language-dependent, not only lexically but also structurally. However, these ones are mostly functorial.
-      AHave    : Person -> Kind        -> Action ;  -- you have a pizza
-      ACitizen : Person -> Citizenship -> Action ;  -- you are Swedish
-      ABePlace : Person -> Place       -> Action ;  -- you are in the bar
+      AHave     : Person -> Kind        -> Action ;  -- you have a pizza
+      AHaveCurr : Person -> Currency    -> Action ;  -- you have dollars
+      ACitizen  : Person -> Citizenship -> Action ;  -- you are Swedish
+      ABePlace  : Person -> Place       -> Action ;  -- you are in the bar
+  
+      ByTransp : Transport -> ByTransport ;         -- by bus
   
   }
 
@@ -184,44 +193,86 @@ properties of kinds (so far mostly of food) 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 ;
 
currency units
-      DanishCrown : Currency ;
+      DanishCrown : Currency ; 
       Dollar : Currency ; 
-      Euro : Currency ;
-      Lei : Currency ;
+      Euro : Currency ; -- Germany, France, Italy, Finland, Spain, The Netherlands
+      Lei : Currency ; -- Romania
+      Leva : Currency ; -- Bulgaria
+      NorwegianCrown : Currency ;
+      Pound : Currency ; -- UK
+      Rouble : Currency ; -- Russia
       SwedishCrown : Currency ;
+      Zloty : Currency ; -- Poland
 
nationalities, countries, languages, citizenships
       Belgian : Citizenship ;
       Belgium : Country ;
+      Bulgarian : Nationality ;
+      Catalan : Nationality ;
+      Danish : Nationality ;
+      Dutch : Nationality ;
       English : Nationality ;
       Finnish : Nationality ;
       Flemish : Language ;
       French : Nationality ;
+      German : Nationality ;
       Italian : Nationality ;
+      Norwegian : Nationality ;
+      Polish : Nationality ;
       Romanian : Nationality ;
+      Russian : Nationality ;
+      Spanish : Nationality ;
       Swedish : Nationality ;
 
+means of transportation +
+      Bike : Transport ; 
+      Bus : Transport ;
+      Car : Transport ;
+      Ferry : Transport ;
+      Plane : Transport ;
+      Subway : Transport ;
+      Taxi : Transport ;
+      Train : Transport ;
+      Tram : Transport ;
+  
+      ByFoot : ByTransport ;
+
+ Actions (which can be expressed by different structures in different languages). Notice that also negations and questions can be formed from these.
@@ -262,8 +313,9 @@ propositions.
       PropOpenDay    : Place -> Day  -> Proposition ;  -- the museum is open on Mondays
       PropClosedDay  : Place -> Day  -> Proposition ;  -- the museum is closed on Mondays
   
-      PSeeYou      : Date -> Phrase ;           -- see you on Monday
-      PSeeYouPlace : Place -> Date -> Phrase ;  -- see you in the bar on Monday
+      PSeeYouPlaceDate : Place -> Date -> Phrase ;     -- see you in the bar on Monday
+      PSeeYouPlace     : Place         -> Phrase ;     -- see you in the bar
+      PSeeYouDate      :          Date -> Phrase ;     -- see you on Monday
 
family relations @@ -278,6 +330,30 @@ week days Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday : Day ; Tomorrow : Date ; + + +transports +
+      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 -> ByTransport -> 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 ?
+
+ +modifiers of places +
+      TheBest : Superlative ;
+      TheClosest : Superlative ;
+      TheCheapest : Superlative ;
+      TheMostExpensive : Superlative ;
+      TheMostPopular : Superlative ;
+      TheWorst : Superlative ;
+  
+      SuperlPlace : Superlative -> PlaceKind -> Place ; -- the best bar
   
   }
 
diff --git a/examples/phrasebook/missing.txt b/examples/phrasebook/missing.txt index 2eaf89d96..3d7d2177b 100644 --- a/examples/phrasebook/missing.txt +++ b/examples/phrasebook/missing.txt @@ -3,7 +3,7 @@ PhrasebookBul : AHasName AHasRoom AHasTable AHungry AIll AKnow ALike ALive ALove PhrasebookDut : PhrasebookEng : PhrasebookFin : -PhrasebookFre : HowFar HowFarBy HowFarFrom HowFarFromBy +PhrasebookFre : PhrasebookGer : AmusementPark Bank Bar Bike Bulgarian Bus ByFoot Cafeteria Car Catalan Center Chicken Cinema CitRestaurant Coffee Danish Disco Dollar Dutch Ferry GNiceToMeetYou German Hotel HowFar HowFarBy HowFarFrom HowFarFromBy IsTranspPlace Lei Leva Meat Museum Norwegian NorwegianCrown PSeeYouDate PSeeYouPlace PSeeYouPlaceDate Park Parking Pharmacy Plane Polish PostOffice Pound Pub Rouble Russian School Shop Spanish Subway SuperlPlace Supermarket Suspect Taxi Tea TheBest TheCheapest TheClosest TheMostExpensive TheMostPopular TheWorst Theatre Toilet Train Tram WhichTranspPlace Zloty Zoo PhrasebookIta : AmusementPark Bank Bike Bulgarian Bus ByFoot Cafeteria Car Catalan Center CitRestaurant Danish Disco Dutch Ferry German HowFar HowFarBy HowFarFrom HowFarFromBy IsTranspPlace Leva Norwegian NorwegianCrown Parking Pharmacy Plane Polish PostOffice Pound Pub Rouble Russian Spanish Subway SuperlPlace Supermarket Taxi TheBest TheCheapest TheClosest TheMostExpensive TheMostPopular TheWorst Train Tram WhichTranspPlace Zloty Zoo PhrasebookRon : GExcusePol GPleaseGivePol GSorryPol diff --git a/examples/phrasebook/phrasebook.html b/examples/phrasebook/phrasebook.html index c5572a575..026a12499 100644 --- a/examples/phrasebook/phrasebook.html +++ b/examples/phrasebook/phrasebook.html @@ -6,7 +6,7 @@

MOLTO Multilingual Phrasebook

-Aarne Ranta
+Krasimir Angelov, Olga Caprotti, Ramona Enache, Thomas Hallgren, Aarne Ranta

@@ -17,6 +17,9 @@ History