diff --git a/examples/phrasebook/DiffPhrasebookRon.gf b/examples/phrasebook/DiffPhrasebookRon.gf index 060b8301d..61e928b72 100644 --- a/examples/phrasebook/DiffPhrasebookRon.gf +++ b/examples/phrasebook/DiffPhrasebookRon.gf @@ -10,7 +10,8 @@ oper want_V2 = dirV2 (lin V want_VV) ; -- mkVV (v_besch74 "vrea") like_V2 = dirV2 (v_besch71 "plăcea") ; - cost_V2 = dirV2 (mkV "costa") ; ---- ? - cost_V = mkV "costa" ; ---- ? + cost_V2 = dirV2(v_besch18 "costa") ; + + cost_V = v_besch18 "costa" ; } diff --git a/examples/phrasebook/DiffPhrasebookSwe.gf b/examples/phrasebook/DiffPhrasebookSwe.gf new file mode 100644 index 000000000..14fbd7bbc --- /dev/null +++ b/examples/phrasebook/DiffPhrasebookSwe.gf @@ -0,0 +1,12 @@ +instance DiffPhrasebookSwe of DiffPhrasebook = open + SyntaxSwe, + ParadigmsSwe +in { + +oper + want_V2 = mkV2 (mkV "önska") ; ---- vill ha + like_V2 = mkV2 (mkV "tycker") (mkPrep "om") ; + + cost_V2 = mkV2 (mkV "kosta") ; + cost_V = mkV "kosta" ; +} diff --git a/examples/phrasebook/GreetingsSwe.gf b/examples/phrasebook/GreetingsSwe.gf new file mode 100644 index 000000000..985027a9d --- /dev/null +++ b/examples/phrasebook/GreetingsSwe.gf @@ -0,0 +1,35 @@ +concrete GreetingsSwe of Greetings = open Prelude in { + +lincat + Greeting, Politeness = SS ; + +lin + GHello = ss "hej" ; + GThanks = ss "tack" ; + GHowAreYou = ss "hur står det till" ; + GPleaseGive = ss "var så god" ; + GExcuse = ss "ursäkta" ; + GSorry = ss "förlåt" ; + GGoodbye = ss "hej då" ; + GBye = ss "hej då" ; + GWhatsYourName = ss "vad heter du" ; + GNiceToMeetYou = ss "trevligt att träffas" ; + GSeeYouSoon = ss "vi ses snart" ; + GHelp = ss "hjälp" ; + GLookOut = ss "se upp" ; + GGoodMorning = ss "god morgon" ; + GGoodDay = ss "god dag" ; + GGoodEvening = ss "god afton" ; + GGoodNight = ss "god natt" ; + GImHungry = ss "jag är hungrig" ; + GImThirsty = ss "jag är törstig" ; + GImTired = ss "jag är trött" ; + GImScared = ss "jag är rädd" ; + GIdontUnderstand = ss "jag förstår inte" ; + GTheCheck = ss "notan" ; + + GYes = ss "ja" ; + GNo = ss "nej" ; + + +} diff --git a/examples/phrasebook/Makefile b/examples/phrasebook/Makefile index 5ece576a8..219f1a4ba 100644 --- a/examples/phrasebook/Makefile +++ b/examples/phrasebook/Makefile @@ -1,3 +1,3 @@ all: - gf -make PhrasebookEng.gf PhrasebookFin.gf PhrasebookFre.gf PhrasebookRon.gf + gf -make PhrasebookEng.gf PhrasebookFin.gf PhrasebookFre.gf PhrasebookRon.gf PhrasebookSwe.gf diff --git a/examples/phrasebook/Phrasebook.gf b/examples/phrasebook/Phrasebook.gf index 001b250f5..3ddd5b573 100644 --- a/examples/phrasebook/Phrasebook.gf +++ b/examples/phrasebook/Phrasebook.gf @@ -6,13 +6,12 @@ abstract Phrasebook = flags startcat = Phrase ; cat - Phrase ; Politeness ; Gender ; -- abstract parameters fun - PNumeral : Numeral -> Phrase ; + +-- here rather than Sentences, because not functorial PSentence : Sentence -> Phrase ; PQuestion : Question -> Phrase ; - PGreeting : Greeting -> Phrase ; ---- PGreeting : Politeness -> Gender -> Gender -> Greeting -> Phrase ; -- politeness level, speaker, hearer diff --git a/examples/phrasebook/PhrasebookEng.gf b/examples/phrasebook/PhrasebookEng.gf index 5aa946bf0..f729950e8 100644 --- a/examples/phrasebook/PhrasebookEng.gf +++ b/examples/phrasebook/PhrasebookEng.gf @@ -5,19 +5,12 @@ concrete PhrasebookEng of Phrasebook = WordsEng ** open (R = Roles), SyntaxEng, - ResEng, ---- for Num to Utt Prelude in { -lincat - Phrase = Text ; - lin - PNumeral n = - mkPhrase ((SyntaxEng.mkCard ).s ! Nom) ; ---- - PSentence s = mkText s ; - PQuestion s = mkText s ; - - PGreeting g = mkPhrase g.s ; + PSentence s = mkText s | lin Text (mkUtt s) ; -- optional . + PQuestion s = mkText s | lin Text (mkUtt s) ; -- optional ? + PGreeting g = lin Text (ss g.s) ; ---- PGreeting p s h g = mkPhrase (g.s ++ p.s ++ s.s ++ h.s) ; Male = {s = [] ; g = R.Male} ; @@ -25,7 +18,4 @@ lin Polite = {s = [] ; p = R.Polite} ; Familiar = {s = [] ; p = R.Familiar} ; -oper - mkPhrase : Str -> Utt = \s -> lin Utt (ss s) ; - } diff --git a/examples/phrasebook/PhrasebookFin.gf b/examples/phrasebook/PhrasebookFin.gf index 2144d90fe..12851e57f 100644 --- a/examples/phrasebook/PhrasebookFin.gf +++ b/examples/phrasebook/PhrasebookFin.gf @@ -4,21 +4,11 @@ concrete PhrasebookFin of Phrasebook = GreetingsFin, WordsFin ** open SyntaxFin, - ResFin, ---- for Num to Utt Prelude in { -lincat - Phrase = Text ; - lin - PNumeral n = - mkPhrase (ss ((SyntaxFin.mkCard ).s ! Sg ! Nom)) ; ---- + PSentence s = mkText s | lin Text (mkUtt s) ; -- optional . + PQuestion s = mkText s | lin Text (mkUtt s) ; -- optional ? PGreeting g = mkPhrase g ; - PSentence s = mkText s ; - PQuestion s = mkText s ; - - -oper - mkPhrase : SS -> Utt = \s -> lin Utt s ; } diff --git a/examples/phrasebook/PhrasebookFre.gf b/examples/phrasebook/PhrasebookFre.gf index 5df0c0c86..a7de6f597 100644 --- a/examples/phrasebook/PhrasebookFre.gf +++ b/examples/phrasebook/PhrasebookFre.gf @@ -7,20 +7,16 @@ concrete PhrasebookFre of Phrasebook = (R = Roles), SyntaxFre, ParadigmsFre, - ResFre, ---- for Num to Utt Prelude in { lincat - Phrase = Text ; Gender = {s : Str ; g : R.Gender} ; Politeness = {s : Str ; p : R.Politeness} ; lin - PNumeral n = mkPhrase ((mkCard ).s ! masculine) ; ---- - PSentence s = mkText s ; - PQuestion s = mkText s ; - - PGreeting g = mkPhrase (g.s ! R.Polite ! R.Male ! R.Male) ; + PSentence s = mkText s | lin Text (mkUtt s) ; -- optional . + PQuestion s = mkText s | lin Text (mkUtt s) ; -- optional ? + PGreeting g = lin Text (ss (g.s ! R.Polite ! R.Male ! R.Male)) ; ---- PGreeting p s h g = mkPhrase (g.s ! p.p ! s.g ! h.g ++ p.s ++ s.s ++ h.s) ; Male = {s = [] ; g = R.Male} ; @@ -28,7 +24,4 @@ lin Polite = {s = [] ; p = R.Polite} ; Familiar = {s = [] ; p = R.Familiar} ; -oper - mkPhrase : Str -> Utt = \s -> lin Utt (ss s) ; - } diff --git a/examples/phrasebook/PhrasebookRon.gf b/examples/phrasebook/PhrasebookRon.gf index 40cdf1eda..cb4c7bacb 100644 --- a/examples/phrasebook/PhrasebookRon.gf +++ b/examples/phrasebook/PhrasebookRon.gf @@ -5,19 +5,11 @@ concrete PhrasebookRon of Phrasebook = WordsRon ** open SyntaxRon, - ResRon, ---- for Num to Utt Prelude in { -lincat - Phrase = Text ; - lin - PNumeral n = mkPhrase (ss ((mkCard ).sp ! Masc)) ; ---- - PGreeting g = mkPhrase g ; - PSentence s = mkText s ; - PQuestion s = mkText s ; - -oper - mkPhrase : SS -> Utt = \s -> lin Utt s ; + PSentence s = mkText s | lin Text (mkUtt s) ; -- optional . + PQuestion s = mkText s | lin Text (mkUtt s) ; -- optional ? + PGreeting g = lin Text g ; } diff --git a/examples/phrasebook/PhrasebookSwe.gf b/examples/phrasebook/PhrasebookSwe.gf new file mode 100644 index 000000000..24241429e --- /dev/null +++ b/examples/phrasebook/PhrasebookSwe.gf @@ -0,0 +1,14 @@ +--# -path=.:present + +concrete PhrasebookSwe of Phrasebook = + GreetingsSwe, + WordsSwe ** open + SyntaxSwe, + Prelude in { + +lin + PSentence s = mkText s | lin Text (mkUtt s) ; -- optional . + PQuestion s = mkText s | lin Text (mkUtt s) ; -- optional ? + PGreeting g = mkPhrase g ; + +} diff --git a/examples/phrasebook/Sentences.gf b/examples/phrasebook/Sentences.gf index d1f79498b..c5105b079 100644 --- a/examples/phrasebook/Sentences.gf +++ b/examples/phrasebook/Sentences.gf @@ -1,10 +1,21 @@ abstract Sentences = Numeral ** { cat + Phrase ; Sentence ; Question ; Object ; Item ; Kind ; Quality ; Place ; PlaceKind ; Currency ; Price ; fun + -- these phrases are formed here, not in Phrasebook, as they are functorial + PObject : Object -> Phrase ; + PKind : Kind -> Phrase ; + PQuality : Quality -> Phrase ; + PNumeral : Numeral -> Phrase ; + PPlace : Place -> Phrase ; + PPlaceKind: PlaceKind-> Phrase ; + PCurrency : Currency -> Phrase ; + PPrice : Price -> Phrase ; + Is : Item -> Quality -> Sentence ; IsNot : Item -> Quality -> Sentence ; diff --git a/examples/phrasebook/SentencesI.gf b/examples/phrasebook/SentencesI.gf index 09096dea5..69d714aa1 100644 --- a/examples/phrasebook/SentencesI.gf +++ b/examples/phrasebook/SentencesI.gf @@ -4,6 +4,7 @@ incomplete concrete SentencesI of Sentences = Numeral ** Syntax in { lincat + Phrase = Text ; Sentence = S ; Question = QS ; Item = NP ; @@ -15,6 +16,15 @@ incomplete concrete SentencesI of Sentences = Numeral ** Currency = CN ; Price = NP ; lin + PObject x = mkPhrase (mkUtt x) ; + PKind x = mkPhrase (mkUtt x) ; + PQuality x = mkPhrase (mkUtt x) ; + PNumeral x = mkPhrase (mkUtt (mkCard (x ** {lock_Numeral = <>}))) ; + PPlace x = mkPhrase (mkUtt x) ; + PPlaceKind x = mkPhrase (mkUtt x) ; + PCurrency x = mkPhrase (mkUtt x) ; + PPrice x = mkPhrase (mkUtt x) ; + Is item quality = mkS (mkCl item quality) ; IsNot item quality = mkS negativePol (mkCl item quality) ; WhetherIs item quality = mkQS (mkQCl (mkCl item quality)) ; @@ -43,4 +53,7 @@ incomplete concrete SentencesI of Sentences = Numeral ** Too quality = mkAP too_AdA quality ; ThePlace kind = mkNP the_Quant kind ; +oper + mkPhrase : Utt -> Text = \u -> lin Text u ; -- no punctuation + } diff --git a/examples/phrasebook/SentencesSwe.gf b/examples/phrasebook/SentencesSwe.gf new file mode 100644 index 000000000..f2e90ddf3 --- /dev/null +++ b/examples/phrasebook/SentencesSwe.gf @@ -0,0 +1,3 @@ +concrete SentencesSwe of Sentences = NumeralSwe ** SentencesI with + (DiffPhrasebook = DiffPhrasebookSwe), + (Syntax = SyntaxSwe) ; diff --git a/examples/phrasebook/Words.gf b/examples/phrasebook/Words.gf index dec6358ac..2ea910272 100644 --- a/examples/phrasebook/Words.gf +++ b/examples/phrasebook/Words.gf @@ -2,7 +2,8 @@ abstract Words = Sentences ** { fun - Wine, Cheese, Fish, Pizza : Kind ; + Wine, Beer, Water, Coffee, Tea : Kind ; + Cheese, Fish, Pizza : Kind ; Fresh, Warm, Italian, Expensive, Delicious, Boring : Quality ; diff --git a/examples/phrasebook/WordsEng.gf b/examples/phrasebook/WordsEng.gf index 017d8aebc..6f9400f94 100644 --- a/examples/phrasebook/WordsEng.gf +++ b/examples/phrasebook/WordsEng.gf @@ -4,6 +4,11 @@ concrete WordsEng of Words = SentencesEng ** open SyntaxEng, ParadigmsEng in { lin Wine = mkCN (mkN "wine") ; + Beer = mkCN (mkN "beer") ; + Water = mkCN (mkN "water") ; + Coffee = mkCN (mkN "coffee") ; + Tea = mkCN (mkN "tea") ; + Pizza = mkCN (mkN "pizza") ; Cheese = mkCN (mkN "cheese") ; Fish = mkCN (mkN "fish" "fish") ; diff --git a/examples/phrasebook/WordsFin.gf b/examples/phrasebook/WordsFin.gf index d26b7f797..159ad55ad 100644 --- a/examples/phrasebook/WordsFin.gf +++ b/examples/phrasebook/WordsFin.gf @@ -4,6 +4,11 @@ concrete WordsFin of Words = SentencesFin ** open SyntaxFin, ParadigmsFin in { lin Wine = mkCN (mkN "viini") ; + Beer = mkCN (mkN "olut") ; + Water = mkCN (mkN "vesi" "veden" "vesiä") ; + Coffee = mkCN (mkN "kahvi") ; + Tea = mkCN (mkN "tee") ; + Pizza = mkCN (mkN "pizza") ; Cheese = mkCN (mkN "juusto") ; Fish = mkCN (mkN "kala") ; diff --git a/examples/phrasebook/WordsFre.gf b/examples/phrasebook/WordsFre.gf index 733038ce3..e8a65a3b8 100644 --- a/examples/phrasebook/WordsFre.gf +++ b/examples/phrasebook/WordsFre.gf @@ -9,6 +9,11 @@ flags coding=utf8 ; lin Wine = mkCN (mkN "vin") ; + Beer = mkCN (mkN "bière") ; + Water = mkCN (mkN "eau" feminine) ; + Coffee = mkCN (mkN "café") ; + Tea = mkCN (mkN "thé") ; + Cheese = mkCN (mkN "fromage" masculine) ; Fish = mkCN (mkN "poisson" masculine) ; Pizza = mkCN (mkN "pizza" feminine) ; diff --git a/examples/phrasebook/WordsRon.gf b/examples/phrasebook/WordsRon.gf index 673eead8f..616306989 100644 --- a/examples/phrasebook/WordsRon.gf +++ b/examples/phrasebook/WordsRon.gf @@ -9,6 +9,11 @@ flags coding=utf8 ; lin Wine = mkCN (mkN "vin" "vinuri" neuter) ; + Beer = mkCN (mkN "bere") ; + Water = mkCN (mkN "apă") ; +---- Coffee = mkCN (mkN "coffee") ; +---- Tea = mkCN (mkN "tea") ; + Cheese = mkCN (mkN "brânză" "brânzeturi" feminine) ; Fish = mkCN (mkN "peÅŸte" "peÅŸti" masculine) ; Pizza = mkCN (mkN "pizza" "pizze" feminine) ; @@ -21,11 +26,11 @@ Delicious = mkAPA "delicios" "delcioasă" "delicioÅŸi" "delicioase" ; Boring = mkAPA "plictisitor" "plictisitoare" "plictisitori" "plictisitoare" ; Restaurant = mkCN (mkN "restaurant") ; - Bar = mkCN (mkN "bar") ; + Bar = mkCN (mkNR "bar") ; Toilet = mkCN (mkN "toaleta") ; - Euro = mkCN (mkN "euro") ; - Dollar = mkCN (mkN "dollar") ; + Euro = mkCN (mkN "euro" "euro") ; + Dollar = mkCN (mkN "dolar" masculine) ; Lei = mkCN (mkN "leu" "lei") ; oper diff --git a/examples/phrasebook/WordsSwe.gf b/examples/phrasebook/WordsSwe.gf new file mode 100644 index 000000000..eee786792 --- /dev/null +++ b/examples/phrasebook/WordsSwe.gf @@ -0,0 +1,30 @@ +-- (c) 2009 Aarne Ranta under LGPL + +concrete WordsSwe of Words = SentencesSwe ** + open SyntaxSwe, ParadigmsSwe in { + lin + Wine = mkCN (mkN "vin" "vinet" "viner" "vinerna") ; + Beer = mkCN (mkN "öl" neutrum) ; + Water = mkCN (mkN "vatten" "vattnet" "vatten" "vattnen") ; + Coffee = mkCN (mkN "kaffe" neutrum) ; + Tea = mkCN (mkN "te" neutrum) ; + + Pizza = mkCN (mkN "pizza") ; + Cheese = mkCN (mkN "ost") ; + Fish = mkCN (mkN "fisk") ; + Fresh = mkAP (mkA "färsk") ; + Warm = mkAP (mkA "varm") ; + Italian = mkAP (mkA "italiensk") ; + Expensive = mkAP (mkA "dyr") ; + Delicious = mkAP (mkA "läcker") ; + Boring = mkAP (mkA "tråkig") ; + + Restaurant = mkCN (mkN "restaurang" "restauranger") ; + Bar = mkCN (mkN "bar" "barer") ; + Toilet = mkCN (mkN "toalett" "toaletter") ; + + Euro = mkCN (mkN "euro" "euro") ; + Dollar = mkCN (mkN "dollar" "dollar") ; + Lei = mkCN (mkN "lei" "lei") ; + +} diff --git a/examples/phrasebook/phrasebook.txt b/examples/phrasebook/phrasebook.txt new file mode 100644 index 000000000..def5f3457 --- /dev/null +++ b/examples/phrasebook/phrasebook.txt @@ -0,0 +1,39 @@ +MOLTO Multilingual Phrasebook +Aarne Ranta + + +=Purpose= + +This phrasebook is a programme for translating touristic phrases +between 15 European languages: +- Bulgarian, Catalan, Danish, Dutch, English, + Finnish, French, German, Italian, Norwegian, + Polish, Romanian, Russian, Spanish, Swedish + + +It is implemented by using the GF programming language +([Grammatical Framework http://grammaticalframework.org]). +It is the first demo for the MOLTO project +([Multilingual On-Line Translation http://www.molto-project.eu]). + +The phrasebook has the following requirements: +- high quality: reliable translations +- translation from any language to any other ones +- runnable in web browsers +- runnable on mobile phones (also off-line: forthcoming for Android phones) +- easily extensible by new words (forthcoming: semi-automatic extensions by users) + + +The phrasebook is available as open-source software, licensed under GNU LGPL. +The source code resides in +[``code.haskell.org/gf/examples/phrasebook/`` http://code.haskell.org/gf/examples/phrasebook/] + + +Current status (28 March 2010): +- available in English, Finnish, French, Romanian, Swedish +- very small coverage +- works on web browsers calling a server +- web service not yet released, but preliminarily available + [here http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html] + +