From a459f0a44942f3209bb21bf939e66371f11f4890 Mon Sep 17 00:00:00 2001
From: aarne
+ The Ontology of the Phrasebook
+
+ Syntactic Structures of the Phrasebook
+This module contains phrases that can be defined by a functor over the
+resource grammar API. The phrases that are likely to have different implementations
+are in the module Words. But the distinction is not quite sharp; thus it may happen
+that the functor instantiations make exceptions.
+
+ abstract Sentences = Numeral ** {
+
+
+The ontology of the phrasebook is defined by the following types. The commented ones
+are defined in other modules.
+
+ cat
+ Phrase ; -- complete phrase, the unit of translation e.g. "Where are you?"
+ Sentence ; -- declarative sentence e.g. "I am in the bar"
+ Question ; -- question, either yes/no or wh e.g. "where are you"
+ -- Greeting ; -- idiomatic phrase, not inflected, e.g. "hello"
+ Proposition ; -- can be turned into sentence or question e.g. "this pizza is good"
+ Object ; -- the object of wanting, ordering, etc e.g. "three pizzas"
+ Item ; -- a single entity e.g. "this pizza"
+ Kind ; -- a type of an item e.g. "pizza"
+ Quality ; -- qualification of an item, can be complex e.g. "very good"
+ Property ; -- basic property of an item, one word e.g. "good"
+ Place ; -- location e.g. "the bar"
+ PlaceKind ; -- type of location e.g. "bar"
+ Currency ; -- currency unit e.g. "leu"
+ Price ; -- number of currency units e.g. "eleven leu"
+ Person ; -- agent wanting or doing something e.g. "you"
+ Action ; -- proposition about a Person e.g. "you are here"
+ Nationality ; -- complex of language, property, country e.g. "Swedish, Sweden"
+ Language ; -- language (can be without nationality) e.g. "Flemish"
+ Citizenship ; -- property (can be without language) e.g. "Belgian"
+ Country ; -- country (can be without language) e.g. "Belgium"
+ Day ; -- weekday type e.g. "Friday"
+ Date ; -- definite date e.g. "on Friday"
+ Name ; -- name of person e.g. "NN"
+ -- Numeral ; -- number expression 1 .. 999,999 e.g. "twenty"
+
+
+Many of the categories are accessible as Phrases, i.e. as translation units.
+
+ fun
+ PSentence : Sentence -> Phrase ;
+ PQuestion : Question -> Phrase ;
+
+ PObject : Object -> Phrase ;
+ PKind : Kind -> Phrase ;
+ PQuality : Quality -> Phrase ;
+ PNumeral : Numeral -> Phrase ;
+ PPlace : Place -> Phrase ;
+ PPlaceKind : PlaceKind-> Phrase ;
+ PCurrency : Currency -> Phrase ;
+ PPrice : Price -> Phrase ;
+ PLanguage : Language -> Phrase ;
+ PCitizenship : Citizenship -> Phrase ;
+ PCountry : Country -> Phrase ;
+ PDay : Day -> Phrase ;
+
+ PYes, PNo : Phrase ;
+
+
+This is the way to build propositions about inanimate items.
+
+ Is : Item -> Quality -> Proposition ; -- this pizza is good
+
+
+To use propositions on higher levels.
+
+ SProp : Proposition -> Sentence ; -- this pizza is good
+ SPropNot : Proposition -> Sentence ; -- this pizza isn't good
+ QProp : Proposition -> Question ; -- is this pizza good
+
+ WherePlace : Place -> Question ; -- where is the bar
+ WherePerson : Person -> Question ; -- where are you
+
+
+This is the way to build propositions about persons.
+
+ PropAction : Action -> Proposition ; -- (you (are|aren't) | are you) Swedish
+
+
+Here are some general syntactic constructions.
+
+ ObjItem : Item -> Object ; -- this pizza
+ ObjNumber : Numeral -> Kind -> Object ; -- five pizzas
+ ObjIndef : Kind -> Object ; -- a pizza
+
+ SuchKind : Quality -> Kind -> Kind ; -- Italian pizza
+ Very : Property -> Quality ; -- very Italian
+ Too : Property -> Quality ; -- too Italian
+ PropQuality : Property -> Quality ; -- Italian
+
+
+Determiners.
+
+ This, That, These, Those : Kind -> Item ; -- this pizza,...,those pizzas
+ The, Thes : Kind -> Item ; -- the pizza, the pizzas
+
+ AmountCurrency : Numeral -> Currency -> Price ; -- five euros
+
+ ThePlace : PlaceKind -> Place ; -- the bar
+
+ IMale, IFemale, -- I, said by man/woman (affects agreement)
+ YouFamMale, YouFamFemale, -- familiar you, said to man/woman (affects agreement)
+ YouPolMale, YouPolFemale : Person ; -- polite you, said to man/woman (affects agreement)
+
+ LangNat : Nationality -> Language ; -- Swedish
+ CitiNat : Nationality -> Citizenship ; -- Swedish
+ CountryNat : Nationality -> Country ; -- Sweden
+ PropCit : Citizenship -> Property ; -- Swedish
+
+ OnDay : Day -> Date ; -- on Friday
+ Today : Date ; -- today
+
+ PersonName : Name -> Person ; -- person referred by name
+ NameNN : Name ; -- the name "NN"
+
+
+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
+
+ }
+
+
+ Words and idiomatic phrases of the Phrasebook
+
+ abstract Words = Sentences ** {
+
+ fun
+
+
+kinds of items (so far mostly food stuff)
+
+ Apple : Kind ;
+ Beer : Kind ;
+ Bread : Kind ;
+ Cheese : Kind ;
+ Chicken : Kind ;
+ Coffee : Kind ;
+ Fish : Kind ;
+ Meat : Kind ;
+ Milk : Kind ;
+ Pizza : Kind ;
+ Salt : Kind ;
+ Tea : Kind ;
+ Water : Kind ;
+ Wine : Kind ;
+
+
+properties of kinds (so far mostly of food)
+
+ Bad : Property ;
+ Boring : Property ;
+ Cheap : Property ;
+ Cold : Property ;
+ Delicious : Property ;
+ Expensive : Property ;
+ Fresh : Property ;
+ Good : Property ;
+ Suspect : Property ;
+ Warm : Property ;
+
+
+kinds of places
+
+ Airport : PlaceKind ;
+ Bar : PlaceKind ;
+ Cinema : PlaceKind ;
+ Church : PlaceKind ;
+ Hospital : PlaceKind ;
+ Hotel : PlaceKind ;
+ Museum : PlaceKind ;
+ Park : PlaceKind ;
+ Restaurant : PlaceKind ;
+ School : PlaceKind ;
+ Shop : PlaceKind ;
+ Station : PlaceKind ;
+ Theatre : PlaceKind ;
+ Toilet : PlaceKind ;
+ University : PlaceKind ;
+
+
+currency units
+
+ DanishCrown : Currency ;
+ Dollar : Currency ;
+ Euro : Currency ;
+ Lei : Currency ;
+ SwedishCrown : Currency ;
+
+
+nationalities, countries, languages, citizenships
+
+ Belgian : Citizenship ;
+ Belgium : Country ;
+ English : Nationality ;
+ Finnish : Nationality ;
+ Flemish : Language ;
+ French : Nationality ;
+ Italian : Nationality ;
+ Romanian : Nationality ;
+ Swedish : Nationality ;
+
+
+Actions (which can be expressed by different structures in different languages).
+Notice that also negations and questions can be formed from these.
+
+ AHasName : Person -> Name -> Action ; -- my name is Bond
+ AHungry : Person -> Action ; -- I am hungry
+ AIll : Person -> Action ; -- I am ill
+ AKnow : Person -> Action ; -- I (don't) know
+ ALike : Person -> Item -> Action ; -- I like this pizza
+ ALive : Person -> Country -> Action ; -- I live in Sweden
+ ALove : Person -> Person -> Action ; -- I love you
+ AScared : Person -> Action ; -- I am scared
+ ASpeak : Person -> Language -> Action ; -- I speak Finnish
+ AThirsty : Person -> Action ; -- I am thirsty
+ ATired : Person -> Action ; -- I am tired
+ AUnderstand : Person -> Action ; -- I (don't) understand
+ AWant : Person -> Object -> Action ; -- I want two beers
+ AWantGo : Person -> Place -> Action ; -- I want to go to the hospital
+
+
+miscellaneous phrases
+
+ QWhatName : Person -> Question ; -- what is your name
+
+ PropOpen : Place -> Proposition ; -- the museum is open
+ PropClosed : Place -> Proposition ; -- the museum is closed
+ PropOpenDate : Place -> Date -> Proposition ; -- the museum is open today
+ PropClosedDate : Place -> Date -> Proposition ; -- the museum is closed today
+ PropOpenDay : Place -> Day -> Proposition ; -- the museum is open on Mondays
+ PropClosedDay : Place -> Day -> Proposition ; -- the museum is closed on Mondays
+
+ HowMuchCost : Item -> Question ; -- how much does the pizza cost
+ ItCost : Item -> Price -> Proposition ; -- the pizza costs five euros
+
+
+week days
+
+ Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday : Day ;
+
+ }
+
+
+
+
diff --git a/examples/phrasebook/Sentences.gf b/examples/phrasebook/Sentences.gf
index c4f70dcaa..773c823a6 100644
--- a/examples/phrasebook/Sentences.gf
+++ b/examples/phrasebook/Sentences.gf
@@ -1,3 +1,6 @@
+--1 The Ontology of the Phrasebook
+
+--2 Syntactic Structures of the Phrasebook
-- This module contains phrases that can be defined by a functor over the
-- resource grammar API. The phrases that are likely to have different implementations
@@ -6,7 +9,8 @@
abstract Sentences = Numeral ** {
--- The ontology of the phrasebook is defined by the following types.
+-- The ontology of the phrasebook is defined by the following types. The commented ones
+-- are defined in other modules.
cat
Phrase ; -- complete phrase, the unit of translation e.g. "Where are you?"
@@ -37,21 +41,21 @@ abstract Sentences = Numeral ** {
-- Many of the categories are accessible as Phrases, i.e. as translation units.
fun
- PSentence : Sentence -> Phrase ;
- PQuestion : Question -> Phrase ;
+ PSentence : Sentence -> Phrase ;
+ PQuestion : Question -> Phrase ;
- PObject : Object -> Phrase ;
- PKind : Kind -> Phrase ;
- PQuality : Quality -> Phrase ;
- PNumeral : Numeral -> Phrase ;
- PPlace : Place -> Phrase ;
- PPlaceKind: PlaceKind-> Phrase ;
- PCurrency : Currency -> Phrase ;
- PPrice : Price -> Phrase ;
- PLanguage : Language -> Phrase ;
+ PObject : Object -> Phrase ;
+ PKind : Kind -> Phrase ;
+ PQuality : Quality -> Phrase ;
+ PNumeral : Numeral -> Phrase ;
+ PPlace : Place -> Phrase ;
+ PPlaceKind : PlaceKind-> Phrase ;
+ PCurrency : Currency -> Phrase ;
+ PPrice : Price -> Phrase ;
+ PLanguage : Language -> Phrase ;
PCitizenship : Citizenship -> Phrase ;
- PCountry : Country -> Phrase ;
- PDay : Day -> Phrase ;
+ PCountry : Country -> Phrase ;
+ PDay : Day -> Phrase ;
PYes, PNo : Phrase ;
@@ -59,11 +63,13 @@ abstract Sentences = Numeral ** {
Is : Item -> Quality -> Proposition ; -- this pizza is good
+-- To use propositions on higher levels.
+
SProp : Proposition -> Sentence ; -- this pizza is good
SPropNot : Proposition -> Sentence ; -- this pizza isn't good
QProp : Proposition -> Question ; -- is this pizza good
- WherePlace : Place -> Question ; -- where is the bar
+ WherePlace : Place -> Question ; -- where is the bar
WherePerson : Person -> Question ; -- where are you
-- This is the way to build propositions about persons.
@@ -99,13 +105,13 @@ abstract Sentences = Numeral ** {
CountryNat : Nationality -> Country ; -- Sweden
PropCit : Citizenship -> Property ; -- Swedish
- OnDay : Day -> Date ; -- on Friday
- Today : Date ; -- today
+ OnDay : Day -> Date ; -- on Friday
+ Today : Date ; -- today
PersonName : Name -> Person ; -- person referred by name
NameNN : Name ; -- the name "NN"
----- NameString : String -> Name ; ---- creates ambiguities with all words
+---- NameString : String -> Name ; ---- creates ambiguities with all words --%
-- Actions are typically language-dependent, not only lexically but also
-- structurally. However, these ones are mostly functorial.
@@ -114,6 +120,5 @@ abstract Sentences = Numeral ** {
ACitizen : Person -> Citizenship -> Action ; -- you are Swedish
ABePlace : Person -> Place -> Action ; -- you are in the bar
-
-
}
+
diff --git a/examples/phrasebook/SentencesFin.gf b/examples/phrasebook/SentencesFin.gf
index 2b6d589c7..43ed440bd 100644
--- a/examples/phrasebook/SentencesFin.gf
+++ b/examples/phrasebook/SentencesFin.gf
@@ -5,5 +5,5 @@ concrete SentencesFin of Sentences = NumeralFin ** SentencesI - [Is,NameNN] with
lin
Is item prop = mkCl item (V.UseComp (CompPartAP prop)) ; -- pizza on herkullista
- NameNN = mkNP (P.mkPN "NN") ;
+ NameNN = mkNP (P.mkPN (P.mkN "NN" "NN:iä")) ;
} ;
diff --git a/examples/phrasebook/Update.hs b/examples/phrasebook/Update.hs
index 1e7cf2578..3d9232d61 100644
--- a/examples/phrasebook/Update.hs
+++ b/examples/phrasebook/Update.hs
@@ -20,4 +20,8 @@ doUpdate src (target,ls) = do
appendFile tmp $ unlines [(line ++ "-- UPDATE FROM " ++ src) | line <- ls]
appendFile tmp "\n}\n"
-dropLastBracket s = s
+tmpFile file = "tmp-update/"++ file
+
+---- quick and dirty
+dropLastBracket = reverse . init . dropWhile (/='}') . reverse
+
diff --git a/examples/phrasebook/Words.gf b/examples/phrasebook/Words.gf
index eac14794e..101fe19ab 100644
--- a/examples/phrasebook/Words.gf
+++ b/examples/phrasebook/Words.gf
@@ -1,4 +1,7 @@
--- (c) 2009 Aarne Ranta under LGPL
+--2 Words and idiomatic phrases of the Phrasebook
+
+
+-- (c) 2009 Aarne Ranta under LGPL --%
abstract Words = Sentences ** {
@@ -72,33 +75,34 @@ abstract Words = Sentences ** {
Romanian : Nationality ;
Swedish : Nationality ;
--- actions (which can be expressed by different structures in different languages)
+-- Actions (which can be expressed by different structures in different languages).
+-- Notice that also negations and questions can be formed from these.
- AHasName : Person -> Name -> Action ;
- AHungry : Person -> Action ;
- AIll : Person -> Action ;
- AKnow : Person -> Action ;
- ALike : Person -> Item -> Action ;
- ALive : Person -> Country -> Action ;
- ALove : Person -> Person -> Action ;
- AScared : Person -> Action ;
- ASpeak : Person -> Language -> Action ;
- AThirsty : Person -> Action ;
- ATired : Person -> Action ;
- AUnderstand : Person -> Action ;
- AWant : Person -> Object -> Action ;
- AWantGo : Person -> Place -> Action ;
+ AHasName : Person -> Name -> Action ; -- my name is Bond
+ AHungry : Person -> Action ; -- I am hungry
+ AIll : Person -> Action ; -- I am ill
+ AKnow : Person -> Action ; -- I (don't) know
+ ALike : Person -> Item -> Action ; -- I like this pizza
+ ALive : Person -> Country -> Action ; -- I live in Sweden
+ ALove : Person -> Person -> Action ; -- I love you
+ AScared : Person -> Action ; -- I am scared
+ ASpeak : Person -> Language -> Action ; -- I speak Finnish
+ AThirsty : Person -> Action ; -- I am thirsty
+ ATired : Person -> Action ; -- I am tired
+ AUnderstand : Person -> Action ; -- I (don't) understand
+ AWant : Person -> Object -> Action ; -- I want two beers
+ AWantGo : Person -> Place -> Action ; -- I want to go to the hospital
-- miscellaneous phrases
- QWhatName : Person -> Question ;
+ QWhatName : Person -> Question ; -- what is your name
- PropOpen : Place -> Proposition ;
- PropClosed : Place -> Proposition ;
- PropOpenDate : Place -> Date -> Proposition ;
- PropClosedDate : Place -> Date -> Proposition ;
- PropOpenDay : Place -> Day -> Proposition ;
- PropClosedDay : Place -> Day -> Proposition ;
+ PropOpen : Place -> Proposition ; -- the museum is open
+ PropClosed : Place -> Proposition ; -- the museum is closed
+ PropOpenDate : Place -> Date -> Proposition ; -- the museum is open today
+ PropClosedDate : Place -> Date -> Proposition ; -- the museum is closed today
+ PropOpenDay : Place -> Day -> Proposition ; -- the museum is open on Mondays
+ PropClosedDay : Place -> Day -> Proposition ; -- the museum is closed on Mondays
HowMuchCost : Item -> Question ; -- how much does the pizza cost
ItCost : Item -> Price -> Proposition ; -- the pizza costs five euros
diff --git a/examples/phrasebook/WordsFin.gf b/examples/phrasebook/WordsFin.gf
index 056874443..f8a8415dd 100644
--- a/examples/phrasebook/WordsFin.gf
+++ b/examples/phrasebook/WordsFin.gf
@@ -144,6 +144,10 @@ concrete WordsFin of Words = SentencesFin **
closed_Adv = ParadigmsFin.mkAdv "kiinni" ;
nameOf : {name : NP ; isPron : Bool ; poss : Det} -> NP = \p ->
- mkNP (E.GenNP p.name) (mkN "nimi" "nimiä") ;
+ let nimi = L.name_N in
+ case p.isPron of {
+ True => mkNP p.poss nimi ;
+ _ => mkNP (E.GenNP p.name) nimi
+ } ;
}
diff --git a/examples/phrasebook/WordsGer.gf b/examples/phrasebook/WordsGer.gf
index 5c49a63e7..02b01445f 100644
--- a/examples/phrasebook/WordsGer.gf
+++ b/examples/phrasebook/WordsGer.gf
@@ -10,125 +10,120 @@ concrete WordsGer of Words = SentencesGer **
Apple = mkCN L.apple_N ;
Beer = mkCN L.beer_N ;
Bread = mkCN L.bread_N ;
--- Cheese = mkCN (mkN "ost") ;
--- Coffee = mkCN (mkN "kaffe" neutrum) ;
+ Cheese = mkCN (mkN "Käse" "Käse" masculine) ;
+-- Coffee = mkCN (mkN "Kaffee" "Kaffee" masculine) ;
Fish = mkCN L.fish_N ;
Milk = mkCN L.milk_N ;
--- Pizza = mkCN (mkN "pizza") ;
+ Pizza = mkCN (mkN "pizza" "pizzen" feminine) ;
Salt = mkCN L.salt_N ;
--- Tea = mkCN (mkN "te" neutrum) ;
+-- Tea = mkCN (mkN "Tee" neutrum) ;
Water = mkCN L.water_N ;
Wine = mkCN L.wine_N ;
-- properties
Bad = L.bad_A ;
--- Boring = mkA "tråkig" ;
+ Boring = mkA "langweilig" ;
Cold = L.cold_A ;
--- Delicious = mkA "läcker" ;
--- Expensive = mkA "dyr" ;
--- Fresh = mkA "färsk" ;
+ Delicious = mkA "lecker" ;
+ Expensive = mkA "teuer" ;
+ Fresh = mkA "frisch" ;
Good = L.good_A ;
Warm = L.warm_A ;
---
--- -- places
---
--- Airport = mkPlace (mkN "flygplats" "flygplatser") "på" ;
+
+-- places
+
+ Airport = mkPlace (mkN "Flughafen" "Flughäfen" masculine) on_Prep to_Prep ;
-- Bar = mkPlace (mkN "bar" "barer") "i" ;
--- Church = mkPlace (mkN "kyrka") "i" ;
--- Hospital = mkPlace (mkN "sjukhus" "sjukhus") "på" ;
+ Church = mkPlace (mkN "Kirche") in_Prep to_Prep ;
+ Hospital = mkPlace (mkN "Krankenhaus" "Krankenhäuser" neuter) in_Prep to_Prep ;
-- Museum = mkPlace (mkN "museum" "museet" "museer" "museerna") "på" ;
--- Restaurant = mkPlace (mkN "restaurang" "restauranger") "på" ;
--- Station = mkPlace (mkN "station" "stationer") "på" ;
+ Restaurant = mkPlace (mkN "Restaurant" "Restaurants" neuter) in_Prep to_Prep ;
+ Station = mkPlace (mkN "Bahnhofen" "Bahnhöfen" masculine) on_Prep to_Prep ;
-- Toilet = mkPlace (mkN "toalett" "toaletter") "på" ;
---
--- -- currencies
---
--- DanishCrown = mkCN (mkA "dansk") (mkN "krona") ;
+ University = mkPlace (mkN "Universität" "Universitäten" feminine)
+ (mkPrep "an" dative) (mkPrep "an" accusative) ;
+
+-- currencies
+
+ DanishCrown = mkCN (mkA "Dänisch") (mkN "Krone") ;
-- Dollar = mkCN (mkN "dollar" "dollar") ;
--- Euro = mkCN (mkN "euro" "euro") ;
+ Euro = mkCN (mkN "Euro" "Euro" neuter) ;
-- Lei = mkCN (mkN "lei" "lei") ;
-- SwedishCrown = mkCN (mkA "svensk") (mkN "krona") ;
---
--- -- nationalities
---
--- Belgian = mkA "belgisk" ;
--- Belgium = mkNP (mkPN "Belgien") ;
--- English = mkNat "engelsk" "England" ;
--- Finnish = mkNat "finsk" "Finland" ;
+
+-- nationalities
+
+ Belgian = mkA "Belgisch" ;
+ Belgium = mkNP (mkPN "Belgien") ;
+ English = mkNat "Englisch" "England" ;
+ Finnish = mkNat "Finnisch" "Finnland" ;
-- Flemish = mkNP (mkPN "flamländska") ;
--- French = mkNat "fransk" "Frankrike" ;
--- Italian = mkNat "italiensk" "Italien" ;
+ French = mkNat "Französisch" "Frankreich" ;
+ Italian = mkNat "Italienisch" "Italien" ;
-- Romanian = mkNat "rumänsk" "Rumänien" ;
-- Swedish = mkNat "svensk" "Sverige" ;
--
-- -- actions
---
--- AHasName p name = mkCl (nameOf p) name ;
--- AHungry p = mkCl p.name (mkA "hungrig") ;
--- AIll p = mkCl p.name (mkA "sjuk") ;
--- AKnow p = mkCl p.name (mkV "veta" "vet" "vet" "visste" "vetat" "visst") ;
--- ALike p item = mkCl p.name (mkV2 (mkV "tycker") (mkPrep "om")) item ;
--- ALive p co = mkCl p.name (mkVP (mkVP (mkV "bo")) (SyntaxGer.mkAdv in_Prep co)) ;
--- ALove p q = mkCl p.name (mkV2 (mkV "älska")) q.name ;
--- AScared p = mkCl p.name (mkA "rädd") ;
--- ASpeak p lang = mkCl p.name (mkV2 (mkV "tala")) lang ;
--- AThirsty p = mkCl p.name (mkA "törstig") ;
--- ATired p = mkCl p.name (mkA "trött") ;
--- AUnderstand p = mkCl p.name (mkV "förstå" "förstod" "förstått") ;
+
+ AHasName p name = mkCl p.name (mkV2 heißen_V) name ;
+ AHungry p = mkCl p.name (mkA "hungrig") ;
+ AIll p = mkCl p.name (mkA "Krank") ;
+ AKnow p = mkCl p.name wissen_V ;
+ ALike p item = mkCl item (mkV2 (fixprefixV "ge" (fallen_V)) dative) p.name ;
+ ALive p co = mkCl p.name (mkVP (mkVP (mkV "wohnen")) (SyntaxGer.mkAdv in_Prep co)) ;
+ ALove p q = mkCl p.name (mkV2 (mkV "lieben")) q.name ;
+ AScared p = mkCl p.name have_V2 (mkNP (mkN "Angst" "Angsten" feminine)) ;
+ ASpeak p lang = mkCl p.name (mkV2 sprechen_V) lang ;
+ AThirsty p = mkCl p.name (mkA "dürstig") ;
+ ATired p = mkCl p.name (mkA "müde") ;
+ AUnderstand p = mkCl p.name (fixprefixV "ver" stehen_V) ;
AWant p obj = mkCl p.name want_VV (mkVP have_V2 obj) ;
AWantGo p place = mkCl p.name want_VV (mkVP (mkVP L.go_V) place.to) ;
---
--- -- miscellaneous
---
--- QWhatName p = mkQS (mkQCl whatSg_IP (mkVP (nameOf p))) ;
---
--- PropOpen p = mkCl p.name open_A ;
--- PropClosed p = mkCl p.name closed_A ;
--- PropOpenDate p d = mkCl p.name (mkVP (mkVP open_A) d) ;
--- PropClosedDate p d = mkCl p.name (mkVP (mkVP closed_A) d) ;
--- PropOpenDay p d = mkCl p.name (mkVP (mkVP open_A) d.habitual) ;
--- PropClosedDay p d = mkCl p.name (mkVP (mkVP closed_A) d.habitual) ;
---
--- HowMuchCost item = mkQS (mkQCl how8much_IAdv (mkCl item (mkV "kosta"))) ;
--- ItCost item price = mkCl item (mkV2 (mkV "kosta")) price ;
---
--- -- week days
---
--- Monday = mkDay "måndag" ;
--- Tuesday = mkDay "tisdag" ;
--- Wednesday = mkDay "onsdag" ;
--- Thursday = mkDay "torsdag" ;
--- Friday = mkDay "fredag" ;
--- Saturday = mkDay "lördag" ;
--- Sunday = mkDay "söndag" ;
---
--- oper
--- mkNat : Str -> Str -> {lang : NP ; prop : A ; country : NP} = \nat,co ->
--- {lang = mkNP (mkPN (nat + "a")) ;
--- prop = mkA nat ; country = mkNP (mkPN co)} ;
---
--- mkDay : Str -> {name : NP ; point : Adv ; habitual : Adv} = \d ->
--- let day = mkNP (mkPN d) in
--- {name = day ;
--- point = SyntaxGer.mkAdv on_Prep day ;
--- habitual = SyntaxGer.mkAdv on_Prep (mkNP a_Quant plNum (mkCN (mkN d)))
--- } ;
---
--- mkPlace : N -> Str -> {name : CN ; at : Prep ; to : Prep} = \p,i -> {
--- name = mkCN p ;
--- at = mkPrep i ;
--- to = to_Prep
--- } ;
---
--- open_A = mkA "öppen" "öppet" ;
--- closed_A = mkA "stängd" "stängt" ;
---
--- nameOf : {name : NP ; isPron : Bool ; poss : Det} -> NP = \p ->
--- case p.isPron of {
--- True => mkNP p.poss (mkN "namn" "namn") ;
--- _ => mkNP (mkNP the_Det (mkN "namn" "namn"))
--- (SyntaxGer.mkAdv possess_Prep p.name)
--- } ;
--- }
+
+-- miscellaneous
+
+ QWhatName p = mkQS (mkQCl how_IAdv (mkCl p.name heißen_V)) ;
+
+ PropOpen p = mkCl p.name open_Adv ;
+ PropClosed p = mkCl p.name closed_Adv ;
+ PropOpenDate p d = mkCl p.name (mkVP (mkVP d) open_Adv) ;
+ PropClosedDate p d = mkCl p.name (mkVP (mkVP d) closed_Adv) ;
+ PropOpenDay p d = mkCl p.name (mkVP (mkVP d.habitual) open_Adv) ;
+ PropClosedDay p d = mkCl p.name (mkVP (mkVP d.habitual) closed_Adv) ;
+
+ HowMuchCost item = mkQS (mkQCl how8much_IAdv (mkCl item (mkV "kosten"))) ;
+ ItCost item price = mkCl item (mkV2 (mkV "kosten")) price ;
+
+-- week days
+
+ Monday = mkDay "Montag" ;
+ Tuesday = mkDay "Dienstag" ;
+ Wednesday = mkDay "Mittwoch" ;
+ Thursday = mkDay "Donnerstag" ;
+ Friday = mkDay "Freitag" ;
+ Saturday = mkDay "Samstag" ;
+ Sunday = mkDay "Sonntag" ;
+
+ oper
+ mkNat : Str -> Str -> {lang : NP ; prop : A ; country : NP} = \nat,co ->
+ {lang = mkNP (mkPN nat) ;
+ prop = mkA nat ; country = mkNP (mkPN co)} ;
+
+ mkDay : Str -> {name : NP ; point : Adv ; habitual : Adv} = \d ->
+ let day = mkNP (mkPN d) in
+ {name = day ;
+ point = SyntaxGer.mkAdv (mkPrep "am" dative) day ; ---- am
+ habitual = ParadigmsGer.mkAdv (d + "s") ----
+ } ;
+
+ mkPlace : N -> Prep -> Prep -> {name : CN ; at : Prep ; to : Prep} = \p,at,to -> {
+ name = mkCN p ;
+ at = at ;
+ to = to
+ } ;
+
+ open_Adv = mkAdv "geöffnet" ; ---- Adv to get right word order easily
+ closed_Adv = mkAdv "geschlossen" ;
+
}
diff --git a/examples/phrasebook/WordsSwe.gf b/examples/phrasebook/WordsSwe.gf
index 4db68c341..2171faf86 100644
--- a/examples/phrasebook/WordsSwe.gf
+++ b/examples/phrasebook/WordsSwe.gf
@@ -64,7 +64,7 @@ concrete WordsSwe of Words = SentencesSwe **
-- actions
- AHasName p name = mkCl (nameOf p) name ;
+ AHasName p name = mkCl p.name (mkV2 (mkV "heter")) name ;
AHungry p = mkCl p.name (mkA "hungrig") ;
AIll p = mkCl p.name (mkA "sjuk") ;
AKnow p = mkCl p.name (mkV "veta" "vet" "vet" "visste" "vetat" "visst") ;
@@ -81,7 +81,7 @@ concrete WordsSwe of Words = SentencesSwe **
-- miscellaneous
- QWhatName p = mkQS (mkQCl whatSg_IP (mkVP (nameOf p))) ;
+ QWhatName p = mkQS (mkQCl whatSg_IP p.name (mkV2 (mkV "heter"))) ;
PropOpen p = mkCl p.name open_A ;
PropClosed p = mkCl p.name closed_A ;
diff --git a/examples/phrasebook/add_greetings.gfupdate b/examples/phrasebook/add_greetings.gfupdate
index 72160882f..a1b2059c7 100644
--- a/examples/phrasebook/add_greetings.gfupdate
+++ b/examples/phrasebook/add_greetings.gfupdate
@@ -1,12 +1,35 @@
-abstract Greetings
-
++ Greetings
fun GCongratulations : Greeting ;
+fun GLeaveMeAlone : Greeting ;
++ GreetingsEng
+lin GCongratulations = ss "congratulations" ;
++ GreetingsFin
+lin GCongratulations = ss "onneksi olkoon" ;
+lin GLeaveMeAlone = ss "jätä minut rauhaan" ;
-lin
-Eng = ss "congratulations" ;
-Fin = ss "onneksi olkoon" ;
Fre = ss "félicitations" ;
Ita = ss "auguri" ;
+
Swe = ss "grattis" ;
+lin
+Eng = ss "leave me alone" ;
+Swe = ss "låt mig vara i fred" ;
+
+
+abstract Words
+
+fun Library : PlaceKind ;
+
+lin
+Eng = mkPlace "library" "in" ;
+Fin = mkPlace (mkN "kirjasto") ssa ;
+Fre = mkPlace (mkN "bibliothèque") dative ;
+Swe = mkPlace (mkN "bibliotek" "bibliotek") "på" ;
+
+concrete WordsGer
+
+lin Delicious = mkA "köstlich" ;
+lin Expensive = mkA "teuer" ;
+
diff --git a/examples/phrasebook/missing.txt b/examples/phrasebook/missing.txt
index 7a1f3ef1c..26037deb4 100644
--- a/examples/phrasebook/missing.txt
+++ b/examples/phrasebook/missing.txt
@@ -5,7 +5,7 @@ PhrasebookDut : AHasName AHungry AIll AKnow ALike ALive ALove AScared ASpeak ATh
PhrasebookEng :
PhrasebookFin : Cinema DanishCrown SwedishCrown Theatre
PhrasebookFre : Cheap Cinema Hotel Park School Shop Suspect Theatre University
-PhrasebookGer : AHasName AHungry AIll AKnow ALike ALive ALove AScared ASpeak AThirsty ATired AUnderstand Airport Bar Belgian Belgium Boring Cheap Cheese Chicken Church Cinema Coffee DanishCrown Delicious Dollar English Euro Expensive Finnish Flemish French Fresh Friday GBye GCheers GDamn GExcuse GExcusePol GGoodDay GGoodEvening GGoodMorning GGoodNight GGoodbye GHello GHelp GHowAreYou GLookOut GNiceToMeetYou GPleaseGive GPleaseGivePol GSeeYouSoon GSorry GSorryPol GThanks GTheCheck Hospital Hotel HowMuchCost ItCost Italian Lei Meat Monday Museum Park Pizza PropClosed PropClosedDate PropClosedDay PropOpen PropOpenDate PropOpenDay QWhatName Restaurant Romanian Saturday School Shop Station Sunday Suspect Swedish SwedishCrown Tea Theatre Thursday Toilet Tuesday University Wednesday
+PhrasebookGer : Bar Cheap Chicken Cinema Coffee Dollar Flemish GNiceToMeetYou Hotel Lei Meat Museum Park Romanian School Shop Suspect Swedish SwedishCrown Tea Theatre Toilet
PhrasebookIta : Cheap Chicken Cinema GNiceToMeetYou Hotel Meat Park School Shop Suspect SwedishCrown Theatre University
PhrasebookNor : AHasName AHungry AIll AKnow ALike ALive ALove AScared ASpeak AThirsty ATired AUnderstand AWant AWantGo Airport Bar Belgian Belgium Boring Cheap Cheese Chicken Church Cinema Coffee DanishCrown Delicious Dollar English Euro Expensive Finnish Flemish French Fresh Friday GBye GCheers GDamn GExcuse GExcusePol GGoodDay GGoodEvening GGoodMorning GGoodNight GGoodbye GHello GHelp GHowAreYou GLookOut GNiceToMeetYou GPleaseGive GPleaseGivePol GSeeYouSoon GSorry GSorryPol GThanks GTheCheck Hospital Hotel HowMuchCost ItCost Italian Lei Meat Monday Museum Park Pizza PropClosed PropClosedDate PropClosedDay PropOpen PropOpenDate PropOpenDay QWhatName Restaurant Romanian Saturday School Shop Station Sunday Suspect Swedish SwedishCrown Tea Theatre Thursday Toilet Tuesday University Wednesday
PhrasebookPol : AHasName AHungry AIll AKnow ALike ALive ALove AScared ASpeak AThirsty ATired AUnderstand AWant AWantGo Airport Bar Belgian Belgium Boring Cheap Cheese Chicken Church Cinema Coffee DanishCrown Delicious Dollar English Euro Expensive Finnish Flemish French Fresh Friday GBye GCheers GDamn GExcuse GExcusePol GGoodDay GGoodEvening GGoodMorning GGoodNight GGoodbye GHello GHelp GHowAreYou GLookOut GNiceToMeetYou GPleaseGive GPleaseGivePol GSeeYouSoon GSorry GSorryPol GThanks GTheCheck Hospital Hotel HowMuchCost ItCost Italian Lei Meat Monday Museum Park Pizza PropClosed PropClosedDate PropClosedDay PropOpen PropOpenDate PropOpenDay QWhatName Restaurant Romanian Saturday School Shop Station Sunday Suspect Swedish SwedishCrown Tea Theatre Thursday Toilet Tuesday University Wednesday
diff --git a/examples/phrasebook/phrasebook.html b/examples/phrasebook/phrasebook.html
index 27671cb99..e7a9bfa58 100644
--- a/examples/phrasebook/phrasebook.html
+++ b/examples/phrasebook/phrasebook.html
@@ -17,6 +17,7 @@
History
It is implemented by using the GF programming language (Grammatical Framework). -It is the first demo for the MOLTO project, released in the third month but to be -updated in the course of the project. +It is the first demo for the MOLTO project, released in the third month (by June 2010) +but to be updated in the course of the project.
The phrasebook has the following requirements:
code.haskell.org/gf/examples/phrasebook/
-Current status (7 April 2010): +Current status (8 April 2010):
http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html
@@ -83,6 +85,12 @@ Current status (7 April 2010):
+Interlingua-based translation. +
++Incremental parsing. +
+The use of resource grammars and functors.
@@ -97,10 +105,13 @@ Disambiguation, esp. of politeness distinctions.
The abstract syntax defines the ontology behind the phrasebook.
-Some explanations can be found in the abstract syntax files
+Some explanations can be found in the
+ontology document, which is produced from the
+abstract syntax files
Sentences.gf
and
-Words.gf.
+Words.gf
+by make doc.
@@ -124,7 +135,7 @@ Separate concrete syntaxes. the input language is ambiguous.
-Here is the module structure as produced by +Here is the module structure as produced in GF by
> i -retain DisambPhrasebookEng.gf
@@ -142,7 +153,7 @@ Improved translation interface
@@ -166,6 +177,10 @@ Link to Google translate, for fall-back and for comparison
Feedback facility in the UI
++Customizable distribution: make your own selection of the 2^15 language subsets +when downloading the phrasebook to a phone +
The basic things "everyone" can do is @@ -188,12 +203,15 @@ Here are the steps to follow for contributors:
darcs pull.
+ from GF Darcs,
+ using darcs pull.
make present in gf/lib/src/.
-gf/examples/phrasebook/.
-make.
+gf/examples/phrasebook/.
+make pgf.
darcs record . (in the phrasebook subdirectory).
-darcs send -o my_phrasebook_patch, which you can send to GF maintainers.
+darcs send -o my_phrasebook_patch, which you can
+ send to GF maintainers.
gf/src/server/ and follow the instructions in the
@@ -206,8 +224,9 @@ Here are the steps to follow for contributors: