1
0
forked from GitHub/gf-core

short-phrase translation; added Swe; started doc in Phrasebook

This commit is contained in:
aarne
2010-03-28 15:28:02 +00:00
parent 5c0fb2cb7e
commit c99ecf2704
20 changed files with 199 additions and 56 deletions

View File

@@ -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" ;
}

View File

@@ -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" ;
}

View File

@@ -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" ;
}

View File

@@ -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

View File

@@ -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

View File

@@ -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 <n : Numeral>).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) ;
}

View File

@@ -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 <n : Numeral>).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 ;
}

View File

@@ -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 <n : Numeral>).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) ;
}

View File

@@ -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 <n : Numeral>).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 ;
}

View File

@@ -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 ;
}

View File

@@ -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 ;

View File

@@ -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
}

View File

@@ -0,0 +1,3 @@
concrete SentencesSwe of Sentences = NumeralSwe ** SentencesI with
(DiffPhrasebook = DiffPhrasebookSwe),
(Syntax = SyntaxSwe) ;

View File

@@ -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 ;

View File

@@ -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") ;

View File

@@ -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") ;

View File

@@ -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) ;

View File

@@ -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

View File

@@ -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") ;
}

View File

@@ -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]