From 4ddf95b89c652a6c63d4b38f020d26d1870b9e0e Mon Sep 17 00:00:00 2001 From: hallgren Date: Thu, 12 May 2016 17:53:56 +0000 Subject: [PATCH] Wide Coverage Translation Demo: select application grammars to use from a list There is now a new button "Grammars..." which show a list where users can select which application grammars to use for translation, in addition to the wide coverage grammar. Application grammars can give higher quality translations in the domain they cover. TODO: make it possible control the order of the selected application grammars. --- src/www/js/wc.js | 100 ++++++++++++++++++++++++++++++++++++++++------- src/www/wc.html | 6 ++- 2 files changed, 91 insertions(+), 15 deletions(-) diff --git a/src/www/js/wc.js b/src/www/js/wc.js index c32d0f2e8..99fcf2edb 100644 --- a/src/www/js/wc.js +++ b/src/www/js/wc.js @@ -2,12 +2,14 @@ /* --- Wide Coverage Translation Demo web app ------------------------------- */ var wc={} -//wc.cnl="Phrasebook" // try this controlled natural language first +wc.selected_cnls=[] // list of grammar names +wc.cnls={} // maps grammars names to {pgf_online:...,grammar_info:{...}} wc.f=document.forms[0] wc.o=element("output") wc.e=element("extra") wc.i=element("grammarinfo") wc.p=element("pick") +wc.grammarbox=element("grammarbox") wc.os=[] /* output segment list [{input,text:String; from,to::Lang; target:Node; @@ -42,6 +44,7 @@ wc.save=function() { wc.local.put("to",f.to.value) wc.local.put("input",f.input.value) wc.local.put("colors",f.colors.checked) + wc.local.put("cnls",wc.selected_cnls) } } @@ -52,6 +55,7 @@ wc.load=function() { f.from.value=wc.local.get("from",f.from.value) f.to.value=wc.local.get("to",f.to.value) f.colors.checked=wc.local.get("colors",f.colors.checked) + wc.selected_cnls=wc.local.get("cnls",wc.selected_cnls) wc.colors() wc.delayed_translate() } @@ -249,25 +253,31 @@ wc.translate=function() { gftranslate.translate(text,f.from.value,wc.languages || f.to.value,i,count,step3) } function step2(text) { trans(text,0,10) } - function step2cnl(text) { + function step2cnl(text,ix) { function step3cnl(results) { var trans=results[0].translations if(trans && trans.length>=1) { for(var i=0;i Demo: GF Wide Coverage Translation + @@ -44,6 +45,8 @@ span.inflect { color: blue; }

GF Wide Coverage Translation Demo

+
+
@@ -87,6 +90,7 @@ span.inflect { color: blue; } Colors +
@@ -109,7 +113,7 @@ span.inflect { color: blue; }

-Last modified: Fri Nov 27 10:47:46 CET 2015 +Last modified: Thu May 12 15:32:41 CEST 2016
About