diff --git a/src/compiler/www/gf-web-api.t2t b/src/compiler/www/gf-web-api.t2t index c58a2e81e..dda1ebefb 100644 --- a/src/compiler/www/gf-web-api.t2t +++ b/src/compiler/www/gf-web-api.t2t @@ -332,27 +332,4 @@ See the source code for details. -------------------------------------------------------------------------------- -==Commands that use the C run-time system== - -GF includes two implementations of the PGF API: the traditional -Haskell implementation and the newer C implementation. The commands documented -above all use the Haskell implementation. -The following commands use the C implementation instead: - -- ``c-parse``, ``c-linearize``, ``c-linearizeAll``, ``c-translate``, - ``c-lookupmorpho``, ``c-flush``, ``c-grammar``, ``c-abstrtree``, - ``c-parsetree``, ``c-wordforword``. - - -They implement the same functionality as the corresponding commands -without the ``c-`` prefix, although there are some restrictions in what -parameters they support, and some differences in the JSON -data structures they output. - -When using these commands, the grammar will be loaded and cached -by the C run-time system. If you use commands from both the Haskell and C -implementations with the same grammar, the grammar will be loaded twice. - --------------------------------------------------------------------------------- - [www.grammaticalframework.org http://www.grammaticalframework.org] diff --git a/src/compiler/www/index.html b/src/compiler/www/index.html index 425c134ef..154b0a545 100644 --- a/src/compiler/www/index.html +++ b/src/compiler/www/index.html @@ -20,7 +20,7 @@
  • GF online editor for simple multilingual grammars
  • Simple Translation Tool (bilingual document editor) - +
  • Wide Coverage Translation Demo
  • Word inflection with smart paradigms
  • GF WordNet (an online browser and editor for the WordNet lexicon)
  • diff --git a/src/compiler/www/js/gftranslate.js b/src/compiler/www/js/gftranslate.js index 4794c95a5..dc280f6eb 100644 --- a/src/compiler/www/js/gftranslate.js +++ b/src/compiler/www/js/gftranslate.js @@ -3,8 +3,8 @@ var gftranslate = {} -gftranslate.jsonurl="/robust/App16.pgf" -gftranslate.grammar="App" // the name of the grammar +gftranslate.jsonurl="/robust/Parse.ngf" +gftranslate.grammar="Parse" // the name of the grammar gftranslate.documented_classes= ["N", "N2", "N3", "A", "A2", "V", "V2", "VV", "VS", "VQ", "VA", "V3", "V2V", @@ -67,31 +67,12 @@ gftranslate.translate=function(source,from,to,start,limit,cont) { var too_long=check_limit(from,source) if(too_long) cont([{error:too_long}]) else - gftranslate.call("?command=c-translate&jsontree=true&input=" + gftranslate.call("?command=translate&jsontree=true&input=" +encodeURIComponent(source) +lexer+"&unlexer=text&from="+g+from+"&to="+enc_langs(g,to) +"&start="+start+"&limit="+limit,extract,errcont) } -// Translate a sentence word for word (if all else fails...) -gftranslate.wordforword=function(source,from,to,cont) { - var g=gftranslate.grammar - var lexer="&lexer=text" - if(from=="Chi") lexer="",source=source.split("").join(" ") - function errcont(text,code) { cont([{error:code+" "+text}]) } - function extract(result) { - cont(unspace_translations(g,result[0].translations)) - } - var enc_to = enc_langs(g,to) - var too_long=check_limit(from,source) - if(too_long) cont([{error:too_long}]) - else - gftranslate.call("?command=c-wordforword&input=" - +encodeURIComponent(source) - +lexer+"&unlexer=text&from="+g+from+"&to="+enc_to - ,extract,errcont) -} - // Get list of supported languages gftranslate.waiting=[] gftranslate.get_languages=function(cont,errcont) { @@ -118,7 +99,7 @@ gftranslate.get_languages=function(cont,errcont) { else { gftranslate.waiting.push({cont:cont,errcont:errcont}) if(gftranslate.waiting.length<2) - gftranslate.call("?command=c-grammar",init2,init2error) + gftranslate.call("?command=grammar",init2,init2error) } } diff --git a/src/compiler/www/js/wc.js b/src/compiler/www/js/wc.js index 422bbc623..bcdf49def 100644 --- a/src/compiler/www/js/wc.js +++ b/src/compiler/www/js/wc.js @@ -214,29 +214,13 @@ wc.translate=function(redo) { //disable(false) } - function word_for_word(text,cont) { - function step3(tra) { - if(tra.length>=1) { - var r=tra[0] - r.prob = -1 - if(r.linearizations) showit(r,gftranslate.grammar) - else if(r.error!=undefined) - show_error(r.error) - } - else if(so.rs.length==0) - show_error("Unable to translate") - } - gftranslate.wordforword(text,f.from.value,wc.languages || f.to.value,step3) - } - function trans(text,i,count) { function step3(tra) { if(tra.length>=1) { var r=tra[0] if(r.error!=undefined) { if(i==0 && so.rs.length==0) { - //show_error(r.error) - word_for_word(text) + show_error(r.error) } } else {