mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-11 22:09:32 -06:00
Action category, more doc in Phrasebook
This commit is contained in:
@@ -2,8 +2,10 @@ abstract Sentences = Numeral ** {
|
||||
|
||||
cat
|
||||
Phrase ;
|
||||
Sentence ; Question ; Object ; Item ; Kind ; Quality ;
|
||||
Place ; PlaceKind ; Currency ; Price ;
|
||||
Sentence ; Question ;
|
||||
Object ; Item ; Kind ; Quality ;
|
||||
Place ; PlaceKind ; Currency ; Price ; Language ;
|
||||
Person ; Action ;
|
||||
|
||||
fun
|
||||
-- these phrases are formed here, not in Phrasebook, as they are functorial
|
||||
@@ -15,15 +17,17 @@ abstract Sentences = Numeral ** {
|
||||
PPlaceKind: PlaceKind-> Phrase ;
|
||||
PCurrency : Currency -> Phrase ;
|
||||
PPrice : Price -> Phrase ;
|
||||
PLanguage : Language -> Phrase ;
|
||||
|
||||
Is : Item -> Quality -> Sentence ;
|
||||
IsNot : Item -> Quality -> Sentence ;
|
||||
|
||||
IWant : Object -> Sentence ;
|
||||
ILike : Item -> Sentence ;
|
||||
DoYouHave : Kind -> Question ;
|
||||
WhetherIs : Item -> Quality -> Question ;
|
||||
WhereIs : Place -> Question ;
|
||||
WhereIs : Place -> Question ;
|
||||
|
||||
SAction : Action -> Sentence ;
|
||||
SNotAction : Action -> Sentence ;
|
||||
QAction : Action -> Question ;
|
||||
|
||||
HowMuchCost : Item -> Question ;
|
||||
ItCost : Item -> Price -> Sentence ;
|
||||
@@ -37,6 +41,8 @@ abstract Sentences = Numeral ** {
|
||||
Very : Quality -> Quality ;
|
||||
Too : Quality -> Quality ;
|
||||
|
||||
I, You : Person ;
|
||||
|
||||
ThePlace : PlaceKind -> Place ;
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ incomplete concrete SentencesI of Sentences = Numeral **
|
||||
PlaceKind = CN ;
|
||||
Currency = CN ;
|
||||
Price = NP ;
|
||||
Action = Cl ;
|
||||
Person = NP ;
|
||||
Language = NP ;
|
||||
lin
|
||||
PObject x = mkPhrase (mkUtt x) ;
|
||||
PKind x = mkPhrase (mkUtt x) ;
|
||||
@@ -24,22 +27,23 @@ incomplete concrete SentencesI of Sentences = Numeral **
|
||||
PPlaceKind x = mkPhrase (mkUtt x) ;
|
||||
PCurrency x = mkPhrase (mkUtt x) ;
|
||||
PPrice x = mkPhrase (mkUtt x) ;
|
||||
PLanguage 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)) ;
|
||||
WhereIs place = mkQS (mkQCl where_IAdv place) ;
|
||||
IWant obj = mkS (mkCl (mkNP i_Pron) want_V2 obj) ;
|
||||
ILike item = mkS (mkCl (mkNP i_Pron) like_V2 item) ;
|
||||
DoYouHave kind =
|
||||
mkQS (mkQCl (mkCl (mkNP youPol_Pron) have_V2 (mkNP kind))) ;
|
||||
|
||||
SAction = mkS ;
|
||||
SNotAction = mkS negativePol ;
|
||||
QAction a = mkQS (mkQCl a) ;
|
||||
|
||||
HowMuchCost item = mkQS (mkQCl how8much_IAdv (mkCl item cost_V)) ;
|
||||
ItCost item price = mkS (mkCl item cost_V2 price) ;
|
||||
AmountCurrency num curr = mkNP <num : Numeral> curr ;
|
||||
AmountCurrency num curr = mkNP <lin Numeral num : Numeral> curr ;
|
||||
|
||||
ObjItem i = i ;
|
||||
ObjNumber n k = mkNP <n : Numeral> k ;
|
||||
ObjNumber n k = mkNP <lin Numeral n : Numeral> k ;
|
||||
|
||||
This kind = mkNP this_Quant kind ;
|
||||
That kind = mkNP that_Quant kind ;
|
||||
@@ -53,6 +57,9 @@ incomplete concrete SentencesI of Sentences = Numeral **
|
||||
Too quality = mkAP too_AdA quality ;
|
||||
ThePlace kind = mkNP the_Quant kind ;
|
||||
|
||||
I = mkNP i_Pron ;
|
||||
You = mkNP youPol_Pron ;
|
||||
|
||||
oper
|
||||
mkPhrase : Utt -> Text = \u -> lin Text u ; -- no punctuation
|
||||
|
||||
|
||||
@@ -11,4 +11,14 @@ abstract Words = Sentences ** {
|
||||
|
||||
Euro, Dollar, Lei : Currency ;
|
||||
|
||||
English, Finnish, French, Romanian, Swedish : Language ;
|
||||
|
||||
-- actions can be expressed by different structures in different languages
|
||||
|
||||
AWant : Person -> Object -> Action ;
|
||||
ALike : Person -> Item -> Action ;
|
||||
AHave : Person -> Kind -> Action ;
|
||||
ASpeak : Person -> Language -> Action ;
|
||||
ALove : Person -> Person -> Action ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
concrete WordsEng of Words = SentencesEng **
|
||||
open SyntaxEng, ParadigmsEng in {
|
||||
open SyntaxEng, ParadigmsEng, IrregEng in {
|
||||
lin
|
||||
Wine = mkCN (mkN "wine") ;
|
||||
Beer = mkCN (mkN "beer") ;
|
||||
@@ -27,4 +27,17 @@ concrete WordsEng of Words = SentencesEng **
|
||||
Dollar = mkCN (mkN "dollar") ;
|
||||
Lei = mkCN (mkN "leu" "lei") ;
|
||||
|
||||
English = mkNP (mkPN "English") ;
|
||||
Finnish = mkNP (mkPN "Finnish") ;
|
||||
French = mkNP (mkPN "French") ;
|
||||
Romanian = mkNP (mkPN "Romanian") ;
|
||||
Swedish = mkNP (mkPN "Swedish") ;
|
||||
|
||||
AWant p obj = mkCl p (mkV2 (mkV "want")) obj ;
|
||||
ALike p item = mkCl p (mkV2 (mkV "like")) item ;
|
||||
AHave p kind = mkCl p have_V2 (mkNP kind) ;
|
||||
ASpeak p lang = mkCl p (mkV2 IrregEng.speak_V) lang ;
|
||||
ALove p q = mkCl p (mkV2 (mkV "love")) q ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
concrete WordsFin of Words = SentencesFin **
|
||||
open SyntaxFin, ParadigmsFin in {
|
||||
open SyntaxFin, ParadigmsFin, DiffPhrasebookFin in {
|
||||
lin
|
||||
Wine = mkCN (mkN "viini") ;
|
||||
Beer = mkCN (mkN "olut") ;
|
||||
@@ -31,7 +31,15 @@ concrete WordsFin of Words = SentencesFin **
|
||||
Dollar = mkCN (mkN "dollari") ;
|
||||
Lei = mkCN (mkN "lei") ;
|
||||
|
||||
-- oper ---- optimization lasts forever
|
||||
-- mkCNN : Str -> CN = \s -> mkCN (mkN s) ;
|
||||
-- mkAPA : Str -> AP = \s -> mkAP (mkA s) ;
|
||||
AWant p obj = mkCl p want_V2 obj ;
|
||||
ALike p item = mkCl item like_V2 p ;
|
||||
AHave p kind = mkCl p have_V2 (mkNP kind) ;
|
||||
ASpeak p lang = mkCl p (mkV2 (mkV "puhua") partitive) lang ;
|
||||
ALove p q = mkCl p (mkV2 (mkV "rakastaa") partitive) q ;
|
||||
|
||||
English = mkNP (mkPN "englanti") ;
|
||||
Finnish = mkNP (mkPN (mkN "suomi" "suomia")) ;
|
||||
French = mkNP (mkPN "ranska") ;
|
||||
Romanian = mkNP (mkPN "romania") ;
|
||||
Swedish = mkNP (mkPN "ruotsi") ;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
concrete WordsFre of Words = SentencesFre ** open
|
||||
SyntaxFre,
|
||||
DiffPhrasebookFre,
|
||||
IrregFre,
|
||||
ParadigmsFre in
|
||||
{
|
||||
flags coding=utf8 ;
|
||||
@@ -33,6 +35,18 @@ Boring = mkAPA "ennuyeux" ;
|
||||
Dollar = mkCN (mkN "dollar") ;
|
||||
Lei = mkCN (mkN "lei") ; ---- ?
|
||||
|
||||
AWant p obj = mkCl p want_V2 obj ;
|
||||
ALike p item = mkCl item plaire_V2 p ;
|
||||
AHave p kind = mkCl p have_V2 (mkNP kind) ;
|
||||
ASpeak p lang = mkCl p (mkV2 (mkV "parler")) lang ;
|
||||
ALove p q = mkCl p (mkV2 (mkV "aimer")) q ;
|
||||
|
||||
English = mkNP (mkPN "anglais") ;
|
||||
Finnish = mkNP (mkPN "finnois") ;
|
||||
French = mkNP (mkPN "français") ;
|
||||
Romanian = mkNP (mkPN "roumain") ;
|
||||
Swedish = mkNP (mkPN "suédois") ;
|
||||
|
||||
oper
|
||||
mkAPA : (_ : Str) -> AP = \x -> mkAP (mkA x) ;
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
concrete WordsRon of Words = SentencesRon ** open
|
||||
SyntaxRon,
|
||||
ParadigmsRon in
|
||||
ParadigmsRon,
|
||||
DiffPhrasebookRon in
|
||||
{
|
||||
flags coding=utf8 ;
|
||||
|
||||
@@ -33,6 +34,18 @@ Boring = mkAPA "plictisitor" "plictisitoare" "plictisitori" "plictisitoare" ;
|
||||
Dollar = mkCN (mkN "dolar" masculine) ;
|
||||
Lei = mkCN (mkN "leu" "lei") ;
|
||||
|
||||
AWant p obj = mkCl p want_V2 obj ;
|
||||
ALike p item = mkCl item like_V2 p ;
|
||||
AHave p kind = mkCl p have_V2 (SyntaxRon.mkNP kind) ;
|
||||
ASpeak p lang = mkCl p (dirV2 (mkV "vorbi")) lang ;
|
||||
ALove p q = mkCl p (dirV2 (mkV "iubi")) q ;
|
||||
|
||||
English = SyntaxRon.mkNP (mkPN "anglais") ; ---- ?
|
||||
-- Finnish = mkNP (mkPN "finnois") ;
|
||||
-- French = mkNP (mkPN "français") ;
|
||||
Romanian = SyntaxRon.mkNP (mkPN "engleză") ; ---- ?
|
||||
-- Swedish = mkNP (mkPN "suédois") ;
|
||||
|
||||
oper
|
||||
mkAPA : (_,_,_,_ : Str) -> AP = \x,y,z,u -> mkAP (mkA x y z u) ;
|
||||
|
||||
|
||||
@@ -27,4 +27,17 @@ concrete WordsSwe of Words = SentencesSwe **
|
||||
Dollar = mkCN (mkN "dollar" "dollar") ;
|
||||
Lei = mkCN (mkN "lei" "lei") ;
|
||||
|
||||
English = mkNP (mkPN "engelska") ;
|
||||
Finnish = mkNP (mkPN "finska") ;
|
||||
French = mkNP (mkPN "franska") ;
|
||||
Romanian = mkNP (mkPN "rumänska") ;
|
||||
Swedish = mkNP (mkPN "svenska") ;
|
||||
|
||||
AWant p obj = mkCl p want_VV (mkVP have_V2 obj) ;
|
||||
ALike p item = mkCl p (mkV2 (mkV "tycker") (mkPrep "om")) item ;
|
||||
AHave p kind = mkCl p have_V2 (mkNP kind) ;
|
||||
ASpeak p lang = mkCl p (mkV2 (mkV "tala")) lang ;
|
||||
ALove p q = mkCl p (mkV2 (mkV "älska")) q ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
120
examples/phrasebook/phrasebook.html
Normal file
120
examples/phrasebook/phrasebook.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
||||
<TITLE>MOLTO Multilingual Phrasebook</TITLE>
|
||||
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
||||
<P ALIGN="center"><CENTER><H1>MOLTO Multilingual Phrasebook</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Aarne Ranta</I><BR>
|
||||
</FONT></CENTER>
|
||||
|
||||
<P>
|
||||
History
|
||||
</P>
|
||||
<UL>
|
||||
<LI>Version 0.1, 26 March 2010. Eng, Fin, Fre, Ron; dedicated minibar UI.
|
||||
<LI>Version 0.2, 28 March. Swe; cat Action; small phrases.
|
||||
</UL>
|
||||
|
||||
<H1>Purpose</H1>
|
||||
<P>
|
||||
This phrasebook is a programme for translating touristic phrases
|
||||
between 15 European languages:
|
||||
</P>
|
||||
<UL>
|
||||
<LI>Bulgarian, Catalan, Danish, Dutch, English,
|
||||
Finnish, French, German, Italian, Norwegian,
|
||||
Polish, Romanian, Russian, Spanish, Swedish
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
It is implemented by using the GF programming language
|
||||
(<A HREF="http://grammaticalframework.org">Grammatical Framework</A>).
|
||||
It is the first demo for the MOLTO project
|
||||
(<A HREF="http://www.molto-project.eu">Multilingual On-Line Translation</A>).
|
||||
</P>
|
||||
<P>
|
||||
The phrasebook has the following requirements:
|
||||
</P>
|
||||
<UL>
|
||||
<LI>high quality: reliable translations
|
||||
<LI>translation from any language to any other ones
|
||||
<LI>runnable in web browsers
|
||||
<LI>runnable on mobile phones (also off-line: forthcoming for Android phones)
|
||||
<LI>easily extensible by new words (forthcoming: semi-automatic extensions by users)
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
The phrasebook is available as open-source software, licensed under GNU LGPL.
|
||||
The source code resides in
|
||||
<A HREF="http://code.haskell.org/gf/examples/phrasebook/"><CODE>code.haskell.org/gf/examples/phrasebook/</CODE></A>
|
||||
</P>
|
||||
<P>
|
||||
Current status (28 March 2010):
|
||||
</P>
|
||||
<UL>
|
||||
<LI>available in English, Finnish, French, Romanian, Swedish
|
||||
<LI>very small coverage
|
||||
<LI>works on web browsers calling a server
|
||||
<LI>web service not yet released, but preliminarily available
|
||||
<A HREF="http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html">here</A>
|
||||
</UL>
|
||||
|
||||
<H1>Points illustrated</H1>
|
||||
<P>
|
||||
The use of resource grammars and functors.
|
||||
</P>
|
||||
<P>
|
||||
Compile-time transfer: especially, in Action in Words.
|
||||
</P>
|
||||
<P>
|
||||
Quasi-incremental translation: many basic types are also used as phrases.
|
||||
</P>
|
||||
<P>
|
||||
Disambiguation, esp. by the parameters in Roles.
|
||||
</P>
|
||||
<H1>Files</H1>
|
||||
<P>
|
||||
abstract Sentences: general syntactic structures implementable by functor
|
||||
</P>
|
||||
<UL>
|
||||
<LI>concrete by functor SencencesI
|
||||
<P></P>
|
||||
abstract Words: words and predicates, typically language-dependent
|
||||
<LI>concrete separate
|
||||
<P></P>
|
||||
abstract Greetings: idiomatic phrases, strings with role dependence
|
||||
<LI>concrete separate
|
||||
<P></P>
|
||||
abstract Phrasebook: put everything everything together
|
||||
<LI>concrete separate
|
||||
<P></P>
|
||||
resource Roles: param Politeness, Gender
|
||||
<P></P>
|
||||
interface DiffPhrasebook: the (so far small) interface for Sentences
|
||||
</UL>
|
||||
|
||||
<H1>To Do</H1>
|
||||
<P>
|
||||
Text-based translation interface.
|
||||
</P>
|
||||
<P>
|
||||
Access to disambiguation grammars in the interface.
|
||||
</P>
|
||||
<P>
|
||||
The remaining 10 languages
|
||||
</P>
|
||||
<P>
|
||||
Extract/construct lexica for
|
||||
</P>
|
||||
<UL>
|
||||
<LI>food stuff
|
||||
<LI>languages
|
||||
<LI>places
|
||||
</UL>
|
||||
|
||||
|
||||
<!-- html code generated by txt2tags 2.4 (http://txt2tags.sf.net) -->
|
||||
<!-- cmdline: txt2tags -thtml phrasebook.txt -->
|
||||
</BODY></HTML>
|
||||
@@ -2,6 +2,12 @@ MOLTO Multilingual Phrasebook
|
||||
Aarne Ranta
|
||||
|
||||
|
||||
History
|
||||
- Version 0.1, 26 March 2010. Eng, Fin, Fre, Ron; dedicated minibar UI.
|
||||
- Version 0.2, 28 March. Swe; cat Action; small phrases.
|
||||
|
||||
|
||||
|
||||
=Purpose=
|
||||
|
||||
This phrasebook is a programme for translating touristic phrases
|
||||
@@ -37,3 +43,54 @@ Current status (28 March 2010):
|
||||
[here http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html]
|
||||
|
||||
|
||||
|
||||
=Points illustrated=
|
||||
|
||||
The use of resource grammars and functors.
|
||||
|
||||
Compile-time transfer: especially, in Action in Words.
|
||||
|
||||
Quasi-incremental translation: many basic types are also used as phrases.
|
||||
|
||||
Disambiguation, esp. by the parameters in Roles.
|
||||
|
||||
|
||||
=Files=
|
||||
|
||||
abstract Sentences: general syntactic structures implementable by functor
|
||||
- concrete by functor SencencesI
|
||||
|
||||
abstract Words: words and predicates, typically language-dependent
|
||||
- concrete separate
|
||||
|
||||
abstract Greetings: idiomatic phrases, strings with role dependence
|
||||
- concrete separate
|
||||
|
||||
abstract Phrasebook: put everything everything together
|
||||
- concrete separate
|
||||
|
||||
resource Roles: param Politeness, Gender
|
||||
|
||||
interface DiffPhrasebook: the (so far small) interface for Sentences
|
||||
|
||||
|
||||
|
||||
=To Do=
|
||||
|
||||
Text-based translation interface.
|
||||
|
||||
Access to disambiguation grammars in the interface.
|
||||
|
||||
The remaining 10 languages
|
||||
|
||||
Extract/construct lexica for
|
||||
- food stuff
|
||||
- languages
|
||||
- places
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
Based on
|
||||
<a href="http://www.cs.chalmers.se/~hallgren/minibar/minibar.html">minibar</a>,
|
||||
powered by
|
||||
<a href="http://www.grammaticalframework.org">GF</a>
|
||||
<a href="http://www.grammaticalframework.org">GF</a>,
|
||||
see
|
||||
<a href="../phrasebook.html">doc</a>.
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
@@ -52,7 +52,7 @@ linTree pgf lang mark e = lin0 [] [] [] Nothing e
|
||||
return (listArray (bounds lins) [computeSeq seqid args | seqid <- elems lins])
|
||||
PCoerce fid -> apply path xs (Just fid) f es
|
||||
Nothing -> mzero
|
||||
Nothing -> apply path xs mb_fid _V [ELit (LStr "?")] -- function without linearization
|
||||
Nothing -> apply path xs mb_fid _V [ELit (LStr ("[" ++ showCId f ++ "]"))] -- fun without lin
|
||||
where
|
||||
lookupProds (Just fid) prods = IntMap.lookup fid prods
|
||||
lookupProds Nothing prods
|
||||
|
||||
Reference in New Issue
Block a user