From 396f23ae60e5c64f74396938bcde77c4d93f2d7d Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 26 May 2010 21:30:04 +0000 Subject: [PATCH] fixes in partitives in Phrasebook --- examples/phrasebook/Implementation.html | 4 +- examples/phrasebook/Makefile | 4 +- examples/phrasebook/Ontology.html | 6 +-- examples/phrasebook/Sentences.gf | 4 +- examples/phrasebook/SentencesFin.gf | 7 ++- examples/phrasebook/SentencesI.gf | 4 +- examples/phrasebook/Words.gf | 2 +- examples/phrasebook/WordsFin.gf | 2 +- examples/phrasebook/missing.txt | 3 +- examples/phrasebook/phrasebook.html | 25 ++++++---- examples/phrasebook/phrasebook.txt | 22 +++++---- .../{phrasebook.html => old-phrasebook.html} | 0 examples/phrasebook/www/support.js | 49 ++++++++++++++++--- 13 files changed, 90 insertions(+), 42 deletions(-) rename examples/phrasebook/www/{phrasebook.html => old-phrasebook.html} (100%) diff --git a/examples/phrasebook/Implementation.html b/examples/phrasebook/Implementation.html index 5cb0635fb..a4b2ccd12 100644 --- a/examples/phrasebook/Implementation.html +++ b/examples/phrasebook/Implementation.html @@ -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 ; diff --git a/examples/phrasebook/Makefile b/examples/phrasebook/Makefile index b1a944276..93c4a70c5 100644 --- a/examples/phrasebook/Makefile +++ b/examples/phrasebook/Makefile @@ -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: diff --git a/examples/phrasebook/Ontology.html b/examples/phrasebook/Ontology.html index e431598da..0765ac4e0 100644 --- a/examples/phrasebook/Ontology.html +++ b/examples/phrasebook/Ontology.html @@ -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.
-      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
 
diff --git a/examples/phrasebook/Sentences.gf b/examples/phrasebook/Sentences.gf index 572d89f74..2d2fc8aab 100644 --- a/examples/phrasebook/Sentences.gf +++ b/examples/phrasebook/Sentences.gf @@ -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 diff --git a/examples/phrasebook/SentencesFin.gf b/examples/phrasebook/SentencesFin.gf index 625890046..61533b35c 100644 --- a/examples/phrasebook/SentencesFin.gf +++ b/examples/phrasebook/SentencesFin.gf @@ -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 ; + } diff --git a/examples/phrasebook/SentencesI.gf b/examples/phrasebook/SentencesI.gf index bcd6f01b8..be7170a93 100644 --- a/examples/phrasebook/SentencesI.gf +++ b/examples/phrasebook/SentencesI.gf @@ -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 ; - 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 ; diff --git a/examples/phrasebook/Words.gf b/examples/phrasebook/Words.gf index 92b423cf3..fd1b2ef7c 100644 --- a/examples/phrasebook/Words.gf +++ b/examples/phrasebook/Words.gf @@ -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 diff --git a/examples/phrasebook/WordsFin.gf b/examples/phrasebook/WordsFin.gf index 995030707..8b5681cb8 100644 --- a/examples/phrasebook/WordsFin.gf +++ b/examples/phrasebook/WordsFin.gf @@ -1,4 +1,4 @@ --- (c) 2009 Aarne Ranta under LGPL +-- (c) 2010 Aarne Ranta under LGPL concrete WordsFin of Words = SentencesFin ** open diff --git a/examples/phrasebook/missing.txt b/examples/phrasebook/missing.txt index c79435613..6ec0d7070 100644 --- a/examples/phrasebook/missing.txt +++ b/examples/phrasebook/missing.txt @@ -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 diff --git a/examples/phrasebook/phrasebook.html b/examples/phrasebook/phrasebook.html index f9c06462a..56b1a8875 100644 --- a/examples/phrasebook/phrasebook.html +++ b/examples/phrasebook/phrasebook.html @@ -6,7 +6,8 @@

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.

@@ -17,9 +18,11 @@ History

- + diff --git a/examples/phrasebook/phrasebook.txt b/examples/phrasebook/phrasebook.txt index 68a0d6f48..fa682596b 100644 --- a/examples/phrasebook/phrasebook.txt +++ b/examples/phrasebook/phrasebook.txt @@ -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
@@ -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 diff --git a/examples/phrasebook/www/phrasebook.html b/examples/phrasebook/www/old-phrasebook.html similarity index 100% rename from examples/phrasebook/www/phrasebook.html rename to examples/phrasebook/www/old-phrasebook.html diff --git a/examples/phrasebook/www/support.js b/examples/phrasebook/www/support.js index 15ccc38d0..e2240624c 100644 --- a/examples/phrasebook/www/support.js +++ b/examples/phrasebook/www/support.js @@ -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