fixes in partitives in Phrasebook

This commit is contained in:
aarne
2010-05-26 21:30:04 +00:00
parent 07a82d602a
commit 396f23ae60
13 changed files with 90 additions and 42 deletions

View File

@@ -85,6 +85,7 @@ gfdoc - a rudimentary GF document generator.
ObjItem i = i ;
ObjNumber n k = mkNP n k ;
ObjIndef k = mkNP a_Quant k ;
ObjPlural k = mkNP aPl_Det k ;
ObjMass k = mkNP k ;
ObjAndObj = mkNP and_Conj ;
OneObj o = o ;
@@ -129,8 +130,7 @@ gfdoc - a rudimentary GF document generator.
NNumeral n = mkCard <lin Numeral n : Numeral> ;
AHave p kind = mkCl p.name have_V2 (mkNP aPl_Det kind) ;
AHaveMass p kind = mkCl p.name have_V2 (mkNP kind) ;
AHave p obj = mkCl p.name have_V2 obj ;
AHaveCurr p curr = mkCl p.name have_V2 (mkNP aPl_Det curr) ;
ACitizen p n = mkCl p.name n ;
ABePlace p place = mkCl p.name place.at ;

View File

@@ -5,10 +5,10 @@ all: fin demo missing
demo: compdemo linkdemo
compdemo:
$(compile) Bul Dan Dut Eng Fre Ger Ita Nor Ron Spa Swe DisambPhrasebookEng
$(compile) Bul Cat Dan Dut Eng Fre Ger Ita Nor Ron Spa Swe DisambPhrasebookEng
linkdemo:
$(compile) -link Eng Bul Dan Dut Fin Fre Ger Ita Nor Ron Spa Swe DisambPhrasebookEng
$(compile) -link Eng Bul Cat Dan Dut Fin Fre Ger Ita Nor Ron Spa Swe DisambPhrasebookEng
#separate, because slow...
fin:

View File

@@ -101,6 +101,7 @@ Here are some general syntactic constructions.
ObjItem : Item -> PrimObject ; -- this pizza
ObjNumber : Number -> Kind -> PrimObject ; -- five pizzas
ObjIndef : Kind -> PrimObject ; -- a pizza
ObjPlural : Kind -> PrimObject ; -- pizzas
ObjMass : MassKind -> PrimObject ; -- water
ObjAndObj : PrimObject -> Object -> Object ; -- this pizza and a beer
OneObj : PrimObject -> Object ; -- this pizza
@@ -146,8 +147,7 @@ Determiners.
Actions are typically language-dependent, not only lexically but also
structurally. However, these ones are mostly functorial.
<pre>
AHave : Person -> Kind -> Action ; -- you have pizzas
AHaveMass : Person -> MassKind -> Action ; -- you have water
AHave : Person -> Object -> Action ; -- you have pizzas
AHaveCurr : Person -> Currency -> Action ; -- you have dollars
ACitizen : Person -> Citizenship -> Action ; -- you are Swedish
ABePlace : Person -> Place -> Action ; -- you are in the bar
@@ -300,7 +300,7 @@ Notice that also negations and questions can be formed from these.
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
AWant : Person -> Object -> Action ; -- I want two apples
AWantGo : Person -> Place -> Action ; -- I want to go to the hospital
</pre>

View File

@@ -90,6 +90,7 @@ abstract Sentences = Numeral ** {
ObjItem : Item -> PrimObject ; -- this pizza
ObjNumber : Number -> Kind -> PrimObject ; -- five pizzas
ObjIndef : Kind -> PrimObject ; -- a pizza
ObjPlural : Kind -> PrimObject ; -- pizzas
ObjMass : MassKind -> PrimObject ; -- water
ObjAndObj : PrimObject -> Object -> Object ; -- this pizza and a beer
OneObj : PrimObject -> Object ; -- this pizza
@@ -133,8 +134,7 @@ abstract Sentences = Numeral ** {
-- Actions are typically language-dependent, not only lexically but also
-- structurally. However, these ones are mostly functorial.
AHave : Person -> Kind -> Action ; -- you have pizzas
AHaveMass : Person -> MassKind -> Action ; -- you have water
AHave : Person -> Object -> Action ; -- you have pizzas
AHaveCurr : Person -> Currency -> Action ; -- you have dollars
ACitizen : Person -> Citizenship -> Action ; -- you are Swedish
ABePlace : Person -> Place -> Action ; -- you are in the bar

View File

@@ -1,5 +1,5 @@
concrete SentencesFin of Sentences = NumeralFin ** SentencesI -
[Is,NameNN,
[Is, NameNN, ObjMass,
IFemale, YouFamFemale, YouPolFemale, IMale, YouFamMale, YouPolMale
] with
(Syntax = SyntaxFin),
@@ -15,5 +15,8 @@ concrete SentencesFin of Sentences = NumeralFin ** SentencesI -
YouFamMale, YouFamFemale =
{name = mkNP (ProDrop youSg_Pron) ; isPron = True ; poss = mkQuant youSg_Pron} ;
YouPolMale, YouPolFemale =
{name = mkNP (ProDrop youPol_Pron) ; isPron = True ; poss = mkQuant youPol_Pron};
{name = mkNP (ProDrop youPol_Pron) ; isPron = True ; poss = mkQuant youPol_Pron} ;
ObjMass = PartCN ;
}

View File

@@ -78,6 +78,7 @@ incomplete concrete SentencesI of Sentences = Numeral **
ObjItem i = i ;
ObjNumber n k = mkNP n k ;
ObjIndef k = mkNP a_Quant k ;
ObjPlural k = mkNP aPl_Det k ;
ObjMass k = mkNP k ;
ObjAndObj = mkNP and_Conj ;
OneObj o = o ;
@@ -120,8 +121,7 @@ incomplete concrete SentencesI of Sentences = Numeral **
NNumeral n = mkCard <lin Numeral n : Numeral> ;
AHave p kind = mkCl p.name have_V2 (mkNP aPl_Det kind) ;
AHaveMass p kind = mkCl p.name have_V2 (mkNP kind) ;
AHave p obj = mkCl p.name have_V2 obj ;
AHaveCurr p curr = mkCl p.name have_V2 (mkNP aPl_Det curr) ;
ACitizen p n = mkCl p.name n ;
ABePlace p place = mkCl p.name place.at ;

View File

@@ -139,7 +139,7 @@ abstract Words = Sentences ** {
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
AWant : Person -> Object -> Action ; -- I want two apples
AWantGo : Person -> Place -> Action ; -- I want to go to the hospital
-- Miscellaneous phrases. Notice that also negations and questions can be formed from

View File

@@ -1,4 +1,4 @@
-- (c) 2009 Aarne Ranta under LGPL
-- (c) 2010 Aarne Ranta under LGPL
concrete WordsFin of Words = SentencesFin **
open

View File

@@ -1,12 +1,13 @@
DisambPhrasebookEng :
PhrasebookBul : GCongratulations GGoodLuck GHappyBirthday
PhrasebookCat : pot01
PhrasebookDan :
PhrasebookDut :
PhrasebookEng :
PhrasebookFin :
PhrasebookFre :
PhrasebookGer :
PhrasebookIta : HowFar HowFarBy HowFarFrom HowFarFromBy Pound
PhrasebookIta :
PhrasebookNor :
PhrasebookRon :
PhrasebookSpa : GCongratulations GGoodLuck GHappyBirthday

View File

@@ -6,7 +6,8 @@
</HEAD><BODY BGCOLOR="white" TEXT="black">
<P ALIGN="center"><CENTER><H1>MOLTO Multilingual Phrasebook</H1>
<FONT SIZE="4">
<I>Krasimir Angelov, Olga Caprotti, Ramona Enache, Thomas Hallgren, Inari Listenmaa, Aarne Ranta </I><BR>
<I>Krasimir Angelov, Olga Caprotti, Ramona Enache, Thomas Hallgren, Inari Listenmaa, Aarne Ranta, Jordi Saludes </I><BR>
Showcase for project FP7-ICT-247914, Deliverable D10.2.
</FONT></CENTER>
<P>
@@ -17,9 +18,11 @@
History
</P>
<UL>
<LI>20 May. Version 0.9:
<LI>26 May. Version 0.9:
Catalan added, mass/count noun distinction to reduce overgeneration,
improved web interface.
<LI>20 May. Version 0.8:
Spanish added, Bulgarian complete.
<P></P>
<LI>9 May. Version 0.7:
Danish and Norwegian added (preliminary versions induced from statistical models
and resource grammars).
@@ -39,7 +42,7 @@ History
<A HREF="missing.txt">Missing constructs</A>
</P>
<P>
<A HREF="http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html">Back to phrasebook</A>
<A HREF="http://www.grammaticalframework.org/demos/phrasebook/">Back to phrasebook</A>
</P>
<P>
</font>
@@ -81,18 +84,17 @@ 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 (20 May 2010):
Current status (26 May 2010):
</P>
<UL>
<LI>small but useful coverage in abstract syntax
<LI>reasonable implementations for
Bulgarian, Danish, Dutch, English, Finnish, French, German,
Bulgarian, Catalan, Danish, Dutch, English, Finnish, French, German,
Italian, Norwegian, Romanian, Spanish, Swedish
<LI>mostly just cloned for the rest of MOLTO languages
<LI>temporary user interdace
<LI>Polish and Russian under construction
<LI>works on web browsers calling a server
<LI>web service not yet released, but preliminarily available in
<A HREF="http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html"><CODE>http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html</CODE></A>
<A HREF="http://www.grammaticalframework.org/demos/phrasebook/">http://www.grammaticalframework.org/demos/phrasebook/</A>
</UL>
<H1>Points illustrated</H1>
@@ -150,6 +152,9 @@ Separate concrete syntaxes.
the input language is ambiguous.
</P>
<P>
<CODE>Numeral</CODE>: resource grammar module directly inherited from the library.
</P>
<P>
Here is the module structure as produced in GF by
</P>
<PRE>
@@ -252,6 +257,6 @@ Here are the steps to follow for contributors:
</UL>
<!-- html code generated by txt2tags 2.4 (http://txt2tags.sf.net) -->
<!-- html code generated by txt2tags 2.5 (http://txt2tags.sf.net) -->
<!-- cmdline: txt2tags -thtml phrasebook.txt -->
</BODY></HTML>

View File

@@ -1,5 +1,6 @@
MOLTO Multilingual Phrasebook
Krasimir Angelov, Olga Caprotti, Ramona Enache, Thomas Hallgren, Inari Listenmaa, Aarne Ranta
Krasimir Angelov, Olga Caprotti, Ramona Enache, Thomas Hallgren, Inari Listenmaa, Aarne Ranta, Jordi Saludes
Showcase for project FP7-ICT-247914, Deliverable D10.2.
%!postproc(html): #HR <HR>
@@ -13,9 +14,11 @@ Krasimir Angelov, Olga Caprotti, Ramona Enache, Thomas Hallgren, Inari Listenmaa
#BSMALL
History
- 20 May. Version 0.9:
- 26 May. Version 0.9:
Catalan added, mass/count noun distinction to reduce overgeneration,
improved web interface.
- 20 May. Version 0.8:
Spanish added, Bulgarian complete.
- 9 May. Version 0.7:
Danish and Norwegian added (preliminary versions induced from statistical models
and resource grammars).
@@ -33,7 +36,7 @@ History
[Missing constructs missing.txt]
[Back to phrasebook http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html]
[Back to phrasebook http://www.grammaticalframework.org/demos/phrasebook/]
#ESMALL
#HR
@@ -68,16 +71,15 @@ The source code resides in
[``code.haskell.org/gf/examples/phrasebook/`` http://code.haskell.org/gf/examples/phrasebook/]
Current status (20 May 2010):
Current status (26 May 2010):
- small but useful coverage in abstract syntax
- reasonable implementations for
Bulgarian, Danish, Dutch, English, Finnish, French, German,
Bulgarian, Catalan, Danish, Dutch, English, Finnish, French, German,
Italian, Norwegian, Romanian, Spanish, Swedish
- mostly just cloned for the rest of MOLTO languages
- temporary user interdace
- Polish and Russian under construction
- works on web browsers calling a server
- web service not yet released, but preliminarily available in
[``http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html`` http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html]
http://www.grammaticalframework.org/demos/phrasebook/
@@ -131,6 +133,8 @@ Separate concrete syntaxes.
``DisambPhrasebook``: disambiguation grammars generating feedback phrases if
the input language is ambiguous.
``Numeral``: resource grammar module directly inherited from the library.
Here is the module structure as produced in GF by
```
> i -retain DisambPhrasebookEng.gf

View File

@@ -1,7 +1,11 @@
/* --- Accessing document elements ------------------------------------------ */
function element(id) {
return document.getElementById(id);
}
/* --- JSONP ---------------------------------------------------------------- */
// Inspired by the function jsonp from
// http://www.west-wind.com/Weblog/posts/107136.aspx
// See also http://niryariv.wordpress.com/2009/05/05/jsonp-quickly/
@@ -12,8 +16,8 @@ function jsonp(url,callback)
url += "&jsonp="
else
url += "?jsonp="
url += callback + "&";
//url += new Date().getTime().toString(); // prevent caching
url += callback;
//url += "&" + new Date().getTime().toString(); // prevent caching
var script = empty("script");
script.setAttribute("src",url);
@@ -52,6 +56,7 @@ function div_class(cls,contents) { return wrap_class("div",cls,contents); }
function p(contents) { return wrap("p",contents); }
function dt(contents) { return wrap("dt",contents); }
function li(contents) { return wrap("li",contents); }
function th(contents) { return wrap("th",contents); }
function td(contents) { return wrap("td",contents); }
@@ -64,13 +69,18 @@ function tr(cells) {
}
function button(label,action) {
var el=empty("input");
el.setAttribute("type","button");
var el=empty("input","type","button");
el.setAttribute("value",label);
el.setAttribute("onclick",action);
return el;
}
function option(label,value) {
var el=empty("option","value",value);
el.innerHTML=label;
return el;
}
function appendChildren(el,cs) {
for(var i=0;i<cs.length;i++)
el.appendChild(cs[i]);
@@ -107,7 +117,10 @@ function swap(a,i,j) { // Note: this doesn't work on strings.
return a;
}
function sort(a) { // Note: this doesn't work on strings.
function sort(a) {
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/sort
return a.sort;
/* // Note: this doesn't work on strings.
for(var i=0;i<a.length-1;i++) {
var min=i;
for(var j=i+1;j<a.length;j++)
@@ -115,6 +128,7 @@ function sort(a) { // Note: this doesn't work on strings.
if(min!=i) swap(a,i,min);
}
return a;
*/
}
function filter(p,xs) {
@@ -124,7 +138,7 @@ function filter(p,xs) {
return ys;
}
function implode(cs) {
function implode(cs) { // array of strings to string
/*
var s="";
for(var i=0;i<cs.length;i++)
@@ -133,6 +147,9 @@ function implode(cs) {
*/
return cs.join("");
}
function hasPrefix(s,pre) { return s.substr(0,pre.length)==pre; }
/*
function all(p,xs) {
for(var i=0;i<xs.length;i++)
@@ -147,6 +164,9 @@ function map(f,xs) {
return ys;
}
// map in continuation passing style
function mapc(f,xs,cont) { mapc_from(f,xs,0,[],cont); }
function mapc_from(f,xs,i,ys,cont) {
if(i<xs.length)
f(xs[i],function(y){ys[i]=y;mapc_from(f,xs,i+1,ys,cont)});
@@ -154,4 +174,19 @@ function mapc_from(f,xs,i,ys,cont) {
cont(ys);
}
function mapc(f,xs,cont) { mapc_from(f,xs,0,[],cont); }
function overlaps(as,bs) {
for(var i=0;i<as.length;i++)
if(elem(as[i],bs)) return true;
return false;
}
function elem(a,as) {
for(var i=0;i<as.length;i++)
if(a==as[i]) return true;
return false;
}
function shuffle(a) {
for(i=0;i<a.length;i++) swap(a,i,Math.floor(Math.random()*a.length))
return a;
}