mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-23 18:02:54 -06:00
Action category, more doc in Phrasebook
This commit is contained in:
@@ -2,8 +2,10 @@ abstract Sentences = Numeral ** {
|
|||||||
|
|
||||||
cat
|
cat
|
||||||
Phrase ;
|
Phrase ;
|
||||||
Sentence ; Question ; Object ; Item ; Kind ; Quality ;
|
Sentence ; Question ;
|
||||||
Place ; PlaceKind ; Currency ; Price ;
|
Object ; Item ; Kind ; Quality ;
|
||||||
|
Place ; PlaceKind ; Currency ; Price ; Language ;
|
||||||
|
Person ; Action ;
|
||||||
|
|
||||||
fun
|
fun
|
||||||
-- these phrases are formed here, not in Phrasebook, as they are functorial
|
-- these phrases are formed here, not in Phrasebook, as they are functorial
|
||||||
@@ -15,16 +17,18 @@ abstract Sentences = Numeral ** {
|
|||||||
PPlaceKind: PlaceKind-> Phrase ;
|
PPlaceKind: PlaceKind-> Phrase ;
|
||||||
PCurrency : Currency -> Phrase ;
|
PCurrency : Currency -> Phrase ;
|
||||||
PPrice : Price -> Phrase ;
|
PPrice : Price -> Phrase ;
|
||||||
|
PLanguage : Language -> Phrase ;
|
||||||
|
|
||||||
Is : Item -> Quality -> Sentence ;
|
Is : Item -> Quality -> Sentence ;
|
||||||
IsNot : Item -> Quality -> Sentence ;
|
IsNot : Item -> Quality -> Sentence ;
|
||||||
|
|
||||||
IWant : Object -> Sentence ;
|
|
||||||
ILike : Item -> Sentence ;
|
|
||||||
DoYouHave : Kind -> Question ;
|
|
||||||
WhetherIs : Item -> Quality -> Question ;
|
WhetherIs : Item -> Quality -> Question ;
|
||||||
WhereIs : Place -> Question ;
|
WhereIs : Place -> Question ;
|
||||||
|
|
||||||
|
SAction : Action -> Sentence ;
|
||||||
|
SNotAction : Action -> Sentence ;
|
||||||
|
QAction : Action -> Question ;
|
||||||
|
|
||||||
HowMuchCost : Item -> Question ;
|
HowMuchCost : Item -> Question ;
|
||||||
ItCost : Item -> Price -> Sentence ;
|
ItCost : Item -> Price -> Sentence ;
|
||||||
AmountCurrency : Numeral -> Currency -> Price ;
|
AmountCurrency : Numeral -> Currency -> Price ;
|
||||||
@@ -37,6 +41,8 @@ abstract Sentences = Numeral ** {
|
|||||||
Very : Quality -> Quality ;
|
Very : Quality -> Quality ;
|
||||||
Too : Quality -> Quality ;
|
Too : Quality -> Quality ;
|
||||||
|
|
||||||
|
I, You : Person ;
|
||||||
|
|
||||||
ThePlace : PlaceKind -> Place ;
|
ThePlace : PlaceKind -> Place ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ incomplete concrete SentencesI of Sentences = Numeral **
|
|||||||
PlaceKind = CN ;
|
PlaceKind = CN ;
|
||||||
Currency = CN ;
|
Currency = CN ;
|
||||||
Price = NP ;
|
Price = NP ;
|
||||||
|
Action = Cl ;
|
||||||
|
Person = NP ;
|
||||||
|
Language = NP ;
|
||||||
lin
|
lin
|
||||||
PObject x = mkPhrase (mkUtt x) ;
|
PObject x = mkPhrase (mkUtt x) ;
|
||||||
PKind x = mkPhrase (mkUtt x) ;
|
PKind x = mkPhrase (mkUtt x) ;
|
||||||
@@ -24,22 +27,23 @@ incomplete concrete SentencesI of Sentences = Numeral **
|
|||||||
PPlaceKind x = mkPhrase (mkUtt x) ;
|
PPlaceKind x = mkPhrase (mkUtt x) ;
|
||||||
PCurrency x = mkPhrase (mkUtt x) ;
|
PCurrency x = mkPhrase (mkUtt x) ;
|
||||||
PPrice x = mkPhrase (mkUtt x) ;
|
PPrice x = mkPhrase (mkUtt x) ;
|
||||||
|
PLanguage x = mkPhrase (mkUtt x) ;
|
||||||
|
|
||||||
Is item quality = mkS (mkCl item quality) ;
|
Is item quality = mkS (mkCl item quality) ;
|
||||||
IsNot item quality = mkS negativePol (mkCl item quality) ;
|
IsNot item quality = mkS negativePol (mkCl item quality) ;
|
||||||
WhetherIs item quality = mkQS (mkQCl (mkCl item quality)) ;
|
WhetherIs item quality = mkQS (mkQCl (mkCl item quality)) ;
|
||||||
WhereIs place = mkQS (mkQCl where_IAdv place) ;
|
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) ;
|
SAction = mkS ;
|
||||||
DoYouHave kind =
|
SNotAction = mkS negativePol ;
|
||||||
mkQS (mkQCl (mkCl (mkNP youPol_Pron) have_V2 (mkNP kind))) ;
|
QAction a = mkQS (mkQCl a) ;
|
||||||
|
|
||||||
HowMuchCost item = mkQS (mkQCl how8much_IAdv (mkCl item cost_V)) ;
|
HowMuchCost item = mkQS (mkQCl how8much_IAdv (mkCl item cost_V)) ;
|
||||||
ItCost item price = mkS (mkCl item cost_V2 price) ;
|
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 ;
|
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 ;
|
This kind = mkNP this_Quant kind ;
|
||||||
That kind = mkNP that_Quant kind ;
|
That kind = mkNP that_Quant kind ;
|
||||||
@@ -53,6 +57,9 @@ incomplete concrete SentencesI of Sentences = Numeral **
|
|||||||
Too quality = mkAP too_AdA quality ;
|
Too quality = mkAP too_AdA quality ;
|
||||||
ThePlace kind = mkNP the_Quant kind ;
|
ThePlace kind = mkNP the_Quant kind ;
|
||||||
|
|
||||||
|
I = mkNP i_Pron ;
|
||||||
|
You = mkNP youPol_Pron ;
|
||||||
|
|
||||||
oper
|
oper
|
||||||
mkPhrase : Utt -> Text = \u -> lin Text u ; -- no punctuation
|
mkPhrase : Utt -> Text = \u -> lin Text u ; -- no punctuation
|
||||||
|
|
||||||
|
|||||||
@@ -11,4 +11,14 @@ abstract Words = Sentences ** {
|
|||||||
|
|
||||||
Euro, Dollar, Lei : Currency ;
|
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
|
-- (c) 2009 Aarne Ranta under LGPL
|
||||||
|
|
||||||
concrete WordsEng of Words = SentencesEng **
|
concrete WordsEng of Words = SentencesEng **
|
||||||
open SyntaxEng, ParadigmsEng in {
|
open SyntaxEng, ParadigmsEng, IrregEng in {
|
||||||
lin
|
lin
|
||||||
Wine = mkCN (mkN "wine") ;
|
Wine = mkCN (mkN "wine") ;
|
||||||
Beer = mkCN (mkN "beer") ;
|
Beer = mkCN (mkN "beer") ;
|
||||||
@@ -27,4 +27,17 @@ concrete WordsEng of Words = SentencesEng **
|
|||||||
Dollar = mkCN (mkN "dollar") ;
|
Dollar = mkCN (mkN "dollar") ;
|
||||||
Lei = mkCN (mkN "leu" "lei") ;
|
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
|
-- (c) 2009 Aarne Ranta under LGPL
|
||||||
|
|
||||||
concrete WordsFin of Words = SentencesFin **
|
concrete WordsFin of Words = SentencesFin **
|
||||||
open SyntaxFin, ParadigmsFin in {
|
open SyntaxFin, ParadigmsFin, DiffPhrasebookFin in {
|
||||||
lin
|
lin
|
||||||
Wine = mkCN (mkN "viini") ;
|
Wine = mkCN (mkN "viini") ;
|
||||||
Beer = mkCN (mkN "olut") ;
|
Beer = mkCN (mkN "olut") ;
|
||||||
@@ -31,7 +31,15 @@ concrete WordsFin of Words = SentencesFin **
|
|||||||
Dollar = mkCN (mkN "dollari") ;
|
Dollar = mkCN (mkN "dollari") ;
|
||||||
Lei = mkCN (mkN "lei") ;
|
Lei = mkCN (mkN "lei") ;
|
||||||
|
|
||||||
-- oper ---- optimization lasts forever
|
AWant p obj = mkCl p want_V2 obj ;
|
||||||
-- mkCNN : Str -> CN = \s -> mkCN (mkN s) ;
|
ALike p item = mkCl item like_V2 p ;
|
||||||
-- mkAPA : Str -> AP = \s -> mkAP (mkA s) ;
|
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
|
concrete WordsFre of Words = SentencesFre ** open
|
||||||
SyntaxFre,
|
SyntaxFre,
|
||||||
|
DiffPhrasebookFre,
|
||||||
|
IrregFre,
|
||||||
ParadigmsFre in
|
ParadigmsFre in
|
||||||
{
|
{
|
||||||
flags coding=utf8 ;
|
flags coding=utf8 ;
|
||||||
@@ -33,6 +35,18 @@ Boring = mkAPA "ennuyeux" ;
|
|||||||
Dollar = mkCN (mkN "dollar") ;
|
Dollar = mkCN (mkN "dollar") ;
|
||||||
Lei = mkCN (mkN "lei") ; ---- ?
|
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
|
oper
|
||||||
mkAPA : (_ : Str) -> AP = \x -> mkAP (mkA x) ;
|
mkAPA : (_ : Str) -> AP = \x -> mkAP (mkA x) ;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
concrete WordsRon of Words = SentencesRon ** open
|
concrete WordsRon of Words = SentencesRon ** open
|
||||||
SyntaxRon,
|
SyntaxRon,
|
||||||
ParadigmsRon in
|
ParadigmsRon,
|
||||||
|
DiffPhrasebookRon in
|
||||||
{
|
{
|
||||||
flags coding=utf8 ;
|
flags coding=utf8 ;
|
||||||
|
|
||||||
@@ -33,6 +34,18 @@ Boring = mkAPA "plictisitor" "plictisitoare" "plictisitori" "plictisitoare" ;
|
|||||||
Dollar = mkCN (mkN "dolar" masculine) ;
|
Dollar = mkCN (mkN "dolar" masculine) ;
|
||||||
Lei = mkCN (mkN "leu" "lei") ;
|
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
|
oper
|
||||||
mkAPA : (_,_,_,_ : Str) -> AP = \x,y,z,u -> mkAP (mkA x y z u) ;
|
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") ;
|
Dollar = mkCN (mkN "dollar" "dollar") ;
|
||||||
Lei = mkCN (mkN "lei" "lei") ;
|
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
|
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=
|
=Purpose=
|
||||||
|
|
||||||
This phrasebook is a programme for translating touristic phrases
|
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]
|
[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
|
Based on
|
||||||
<a href="http://www.cs.chalmers.se/~hallgren/minibar/minibar.html">minibar</a>,
|
<a href="http://www.cs.chalmers.se/~hallgren/minibar/minibar.html">minibar</a>,
|
||||||
powered by
|
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>
|
</body>
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ abstract Phrase = Cat ** {
|
|||||||
UttAdv : Adv -> Utt ; -- here
|
UttAdv : Adv -> Utt ; -- here
|
||||||
UttVP : VP -> Utt ; -- to sleep
|
UttVP : VP -> Utt ; -- to sleep
|
||||||
UttCN : CN -> Utt ; -- house
|
UttCN : CN -> Utt ; -- house
|
||||||
|
UttCard : Card -> Utt ; -- five
|
||||||
|
UttAP : AP -> Utt ; -- fine
|
||||||
|
|
||||||
-- The phrasal conjunction is optional. A sentence conjunction
|
-- The phrasal conjunction is optional. A sentence conjunction
|
||||||
-- can also used to prefix an utterance.
|
-- can also used to prefix an utterance.
|
||||||
|
|||||||
@@ -154,7 +154,10 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
mkUtt : IAdv -> Utt ; -- 7. why --# notminimal
|
mkUtt : IAdv -> Utt ; -- 7. why --# notminimal
|
||||||
mkUtt : NP -> Utt ; -- 8. John --# notminimal
|
mkUtt : NP -> Utt ; -- 8. John --# notminimal
|
||||||
mkUtt : Adv -> Utt ; -- 9. here --# notminimal
|
mkUtt : Adv -> Utt ; -- 9. here --# notminimal
|
||||||
mkUtt : VP -> Utt -- 10. to walk --# notminimal
|
mkUtt : VP -> Utt ; -- 10. to walk --# notminimal
|
||||||
|
mkUtt : CN -> Utt ; -- 11. beer --# notminimal
|
||||||
|
mkUtt : AP -> Utt ; -- 12. fine --# notminimal
|
||||||
|
mkUtt : Card -> Utt ; -- 13. five --# notminimal
|
||||||
} ; --# notminimal
|
} ; --# notminimal
|
||||||
|
|
||||||
-- The plural first-person imperative is a special construction.
|
-- The plural first-person imperative is a special construction.
|
||||||
@@ -1361,7 +1364,10 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
mkUtt : Adv -> Utt -- here
|
mkUtt : Adv -> Utt -- here
|
||||||
= UttAdv ;
|
= UttAdv ;
|
||||||
mkUtt : VP -> Utt -- to sleep --# notminimal
|
mkUtt : VP -> Utt -- to sleep --# notminimal
|
||||||
= UttVP --# notminimal
|
= UttVP ; --# notminimal
|
||||||
|
mkUtt : CN -> Utt = UttCN ; --# notminimal
|
||||||
|
mkUtt : AP -> Utt = UttAP ; --# notminimal
|
||||||
|
mkUtt : Card -> Utt = UttCard ; --# notminimal
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
lets_Utt : VP -> Utt = ImpPl1 ; --# notminimal
|
lets_Utt : VP -> Utt = ImpPl1 ; --# notminimal
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ resource MakeStructuralEng = open CatEng, ParadigmsEng, ResEng, MorphoEng, Prelu
|
|||||||
oper
|
oper
|
||||||
mkSubj : Str -> Subj = \x ->
|
mkSubj : Str -> Subj = \x ->
|
||||||
lin Subj {s = x} ;
|
lin Subj {s = x} ;
|
||||||
mkNP : Str -> Number -> NP = \s,n ->
|
mkNP : Str -> ParadigmsEng.Number -> NP = \s,n ->
|
||||||
lin NP (regNP s n) ;
|
lin NP (regNP s n) ;
|
||||||
mkIDet : Str -> Number -> IDet = \s,n ->
|
mkIDet : Str -> ParadigmsEng.Number -> IDet = \s,n ->
|
||||||
lin IDet {s = s ; n = n} ;
|
lin IDet {s = s ; n = n} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ concrete PhraseEng of Phrase = CatEng ** open Prelude, ResEng in {
|
|||||||
UttVP vp = {s = infVP False vp (agrP3 Sg)} ;
|
UttVP vp = {s = infVP False vp (agrP3 Sg)} ;
|
||||||
UttAdv adv = adv ;
|
UttAdv adv = adv ;
|
||||||
UttCN n = {s = n.s ! Sg ! Nom} ;
|
UttCN n = {s = n.s ! Sg ! Nom} ;
|
||||||
|
UttCard n = {s = n.s ! Nom} ;
|
||||||
|
UttAP ap = {s = ap.s ! agrP3 Sg} ;
|
||||||
|
|
||||||
NoPConj = {s = []} ;
|
NoPConj = {s = []} ;
|
||||||
PConjConj conj = {s = conj.s2} ; ---
|
PConjConj conj = {s = conj.s2} ; ---
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
resource MakeStructuralFin = open CatFin, ParadigmsFin, MorphoFin, Prelude in {
|
resource MakeStructuralFin = open CatFin, ParadigmsFin, MorphoFin, Prelude in {
|
||||||
|
|
||||||
oper
|
oper
|
||||||
mkConj : Str -> Str -> Number -> Conj = \x,y,n ->
|
mkConj : Str -> Str -> ParadigmsFin.Number -> Conj = \x,y,n ->
|
||||||
{s1 = x ; s2 = y ; n = n ; lock_Conj = <>} ;
|
{s1 = x ; s2 = y ; n = n ; lock_Conj = <>} ;
|
||||||
mkSubj : Str -> Subj = \x ->
|
mkSubj : Str -> Subj = \x ->
|
||||||
{s = x ; lock_Subj = <>} ;
|
{s = x ; lock_Subj = <>} ;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
concrete PhraseFin of Phrase = CatFin ** open ResFin in {
|
concrete PhraseFin of Phrase = CatFin ** open ResFin, (P = Prelude) in {
|
||||||
|
|
||||||
lin
|
lin
|
||||||
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
|
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
|
||||||
@@ -14,6 +14,9 @@ concrete PhraseFin of Phrase = CatFin ** open ResFin in {
|
|||||||
UttNP np = {s = np.s ! NPCase Nom} ;
|
UttNP np = {s = np.s ! NPCase Nom} ;
|
||||||
UttVP vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp Inf1} ;
|
UttVP vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp Inf1} ;
|
||||||
UttAdv adv = adv ;
|
UttAdv adv = adv ;
|
||||||
|
UttCN np = {s = np.s ! NCase Sg Nom} ;
|
||||||
|
UttAP np = {s = np.s ! P.False ! NCase Sg Nom} ;
|
||||||
|
UttCard n = {s = n.s ! Sg ! Nom} ;
|
||||||
|
|
||||||
NoPConj = {s = []} ;
|
NoPConj = {s = []} ;
|
||||||
PConjConj conj = {s = conj.s2} ;
|
PConjConj conj = {s = conj.s2} ;
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ incomplete concrete PhraseRomance of Phrase =
|
|||||||
UttVP vp = {s = infVP vp (agrP3 Fem Sg)} ; --- Agr
|
UttVP vp = {s = infVP vp (agrP3 Fem Sg)} ; --- Agr
|
||||||
UttAdv adv = adv ;
|
UttAdv adv = adv ;
|
||||||
UttCN n = {s = n.s ! Sg} ;
|
UttCN n = {s = n.s ! Sg} ;
|
||||||
|
UttAP ap = {s = ap.s ! AF Masc Sg} ;
|
||||||
|
UttCard n = {s = n.s ! Masc} ;
|
||||||
|
|
||||||
NoPConj = {s = []} ;
|
NoPConj = {s = []} ;
|
||||||
PConjConj conj = {s = conj.s2} ;
|
PConjConj conj = {s = conj.s2} ;
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
UttVP vp = let a = agrP3 Masc Sg in
|
UttVP vp = let a = agrP3 Masc Sg in
|
||||||
{s = "sã" ++ (flattenSimpleClitics vp.nrClit vp.clAcc vp.clDat (vp.isRefl ! a)) ++ conjVP vp a ++vp.comp ! a ++ vp.ext ! Pos} ;
|
{s = "sã" ++ (flattenSimpleClitics vp.nrClit vp.clAcc vp.clDat (vp.isRefl ! a)) ++ conjVP vp a ++vp.comp ! a ++ vp.ext ! Pos} ;
|
||||||
UttAdv adv = adv ;
|
UttAdv adv = adv ;
|
||||||
|
UttCN cn = {s = cn.s ! Sg ! Indef ! ANomAcc} ;
|
||||||
|
UttAP ap = {s = ap.s ! AF Masc Sg Indef ANomAcc} ;
|
||||||
|
UttCard n = {s = n.sp ! Masc} ;
|
||||||
|
|
||||||
NoPConj = {s = []} ;
|
NoPConj = {s = []} ;
|
||||||
PConjConj conj = {s = conj.s2} ;
|
PConjConj conj = {s = conj.s2} ;
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ incomplete concrete PhraseScand of Phrase =
|
|||||||
UttNP np = {s = np.s ! accusative} ;
|
UttNP np = {s = np.s ! accusative} ;
|
||||||
UttVP vp = {s = infMark ++ infVP vp (agrP3 Utr Sg)} ;
|
UttVP vp = {s = infMark ++ infVP vp (agrP3 Utr Sg)} ;
|
||||||
UttAdv adv = adv ;
|
UttAdv adv = adv ;
|
||||||
|
UttCN n = {s = n.s ! Sg ! DIndef ! Nom} ;
|
||||||
|
UttAP n = {s = n.s ! Strong (GSg Utr)} ;
|
||||||
|
UttCard n = {s = n.s ! neutrum} ;
|
||||||
|
|
||||||
NoPConj = {s = []} ;
|
NoPConj = {s = []} ;
|
||||||
PConjConj conj = {s = conj.s2} ;
|
PConjConj conj = {s = conj.s2} ;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ concrete StructuralSwe of Structural = CatSwe **
|
|||||||
here7to_Adv = ss "hit" ;
|
here7to_Adv = ss "hit" ;
|
||||||
here7from_Adv = ss "härifrån" ;
|
here7from_Adv = ss "härifrån" ;
|
||||||
how_IAdv = ss "hur" ;
|
how_IAdv = ss "hur" ;
|
||||||
|
how8much_IAdv = ss "hur mycket" ;
|
||||||
how8many_IDet = {s = \\_ => ["hur många"] ; n = Pl ; det = DDef Indef} ;
|
how8many_IDet = {s = \\_ => ["hur många"] ; n = Pl ; det = DDef Indef} ;
|
||||||
if_Subj = ss "om" ;
|
if_Subj = ss "om" ;
|
||||||
in8front_Prep = ss "framför" ;
|
in8front_Prep = ss "framför" ;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ linTree pgf lang mark e = lin0 [] [] [] Nothing e
|
|||||||
return (listArray (bounds lins) [computeSeq seqid args | seqid <- elems lins])
|
return (listArray (bounds lins) [computeSeq seqid args | seqid <- elems lins])
|
||||||
PCoerce fid -> apply path xs (Just fid) f es
|
PCoerce fid -> apply path xs (Just fid) f es
|
||||||
Nothing -> mzero
|
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
|
where
|
||||||
lookupProds (Just fid) prods = IntMap.lookup fid prods
|
lookupProds (Just fid) prods = IntMap.lookup fid prods
|
||||||
lookupProds Nothing prods
|
lookupProds Nothing prods
|
||||||
|
|||||||
Reference in New Issue
Block a user