mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-17 08:49:31 -06:00
Wide coverage translation web demo improvements
+ Add lexing/unlexing + Add a button to swap input and output + Minor layout adjustments
This commit is contained in:
@@ -3,7 +3,7 @@ Powered by multilingual grammars
|
||||
|
||||
%!style:../css/style.css
|
||||
%!postproc(html): <H1> <H1><a href="../"><IMG src="../doc/Logos/gf0.svg" alt=""></a>
|
||||
%!postproc(html): #GFWCT <iframe style="border: 0; width: 100%; height: 24ex;" src="wc.html"></iframe>
|
||||
%!postproc(html): #GFWCT <iframe style="border: 0; width: 100%; height: 24ex;" src="http://cloud.grammaticalframework.org/wc.html#embed"></iframe>
|
||||
|
||||
==Try it online==
|
||||
|
||||
|
||||
@@ -272,3 +272,7 @@ function check_exp(s,cont) {
|
||||
}
|
||||
gfshell("cc "+s,check);
|
||||
}
|
||||
|
||||
// Lexing/unlexing text
|
||||
function lextext(txt,cont) { gfshell('ps -lextext "'+txt+'"',cont) }
|
||||
function unlextext(txt,cont) { gfshell('ps -bind -unlextext "'+txt+'"',cont) }
|
||||
|
||||
@@ -1193,9 +1193,6 @@ function save_in_cloud(filename,document,cont) {
|
||||
with_dir(save)
|
||||
}
|
||||
|
||||
function unlextext(txt,cont) { gfshell('ps -bind -unlextext "'+txt+'"',cont) }
|
||||
function lextext(txt,cont) { gfshell('ps -lextext "'+txt+'"',cont) }
|
||||
|
||||
// Like lextext, but separate punctuation from the end
|
||||
function lexgfrobust(txt,cont) {
|
||||
function rmpunct(txt) {
|
||||
|
||||
@@ -1,21 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html> <head>
|
||||
<title>Demo: GF Wide Coverage Translation</title>
|
||||
<link rel=stylesheet href="../css/style.css">
|
||||
<link rel="stylesheet" type="text/css" href="gfse/editor.css" title="Cloud">
|
||||
<meta name = "viewport" content = "width = device-width">
|
||||
<meta charset="UTF-8">
|
||||
<link rel=top href="../" title="GF">
|
||||
<style>
|
||||
div.center { text-align: center; }
|
||||
table.center { margin-left: auto; margin-right: auto; }
|
||||
textarea { margin: 0; }
|
||||
body:target h1, body:target div.modtime { display: none; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div style="display: none">
|
||||
<h1><a href="../"><img class=nofloat style="height: 3ex" src="../doc/Logos/gf0.png" alt="GF"></a>
|
||||
Wide Coverage Translation</h1>
|
||||
</div>
|
||||
<form onsubmit="return wctranslate()">
|
||||
<body id=embed>
|
||||
<div class=center>
|
||||
<p>
|
||||
<textarea name=input rows=3 cols=50></textarea>
|
||||
<h1><a href="http://www.grammaticalframework.org/"><img class=nofloat src="P/gf-cloud.png" alt="GF"></a> Wide Coverage Translation</h1>
|
||||
</div>
|
||||
|
||||
<table class="center">
|
||||
<tr><td>
|
||||
<form onsubmit="return wctranslate()">
|
||||
<textarea name=input rows=3 style="width: 100%"></textarea>
|
||||
<br>
|
||||
<big>⤷</big>
|
||||
<select name=from>
|
||||
@@ -29,7 +35,7 @@ Wide Coverage Translation</h1>
|
||||
<option value=Swe>Swedish</option>
|
||||
</select> →
|
||||
<button name=translate type=submit><strong><big>Translate</big></strong></button> →
|
||||
<select name=to>
|
||||
<select name=to onchange="wctranslate()">
|
||||
<option value=Bul>Bulgarian</option>
|
||||
<option value=Chi>Chinese</option>
|
||||
<option value=Eng>English</option>
|
||||
@@ -40,29 +46,47 @@ Wide Coverage Translation</h1>
|
||||
<option value=Swe selected>Swedish</option>
|
||||
</select>
|
||||
<big style="position: relative; top: 1ex">⤵</big>
|
||||
<button onclick="wcswap()">↑↓</button>
|
||||
<br>
|
||||
<textarea name=output rows=3 cols=50 readonly></textarea>
|
||||
</div>
|
||||
<textarea name=output rows=3 style="width: 100%" readonly></textarea>
|
||||
</form>
|
||||
|
||||
<div style="display: none" class=modtime><small>
|
||||
<!-- hhmts start -->Last modified: Thu Jan 23 15:22:27 CET 2014 <!-- hhmts end -->
|
||||
|
||||
</table>
|
||||
<p>
|
||||
<div class=modtime><small>
|
||||
<!-- hhmts start -->Last modified: Tue Jan 28 17:38:32 CET 2014 <!-- hhmts end -->
|
||||
</small></div>
|
||||
<script src="../src/www/js/support.js"></script>
|
||||
<script src="../src/www/js/gftranslate.js"></script>
|
||||
<script src="js/support.js"></script>
|
||||
<script src="js/gftranslate.js"></script>
|
||||
<script src="js/localstorage.js"></script>
|
||||
<script src="gfse/localstorage.js"></script>
|
||||
<script src="gfse/cloud2.js"></script>
|
||||
<script>
|
||||
gftranslate.jsonurl="http://cloud.grammaticalframework.org/robust/Translate8.pgf"
|
||||
function wctranslate() {
|
||||
var f=document.forms[0]
|
||||
f.translate.disabled=true
|
||||
f.output.value=""
|
||||
|
||||
function showit(result) {
|
||||
f.output.value=result
|
||||
f.translate.disabled=false
|
||||
}
|
||||
f.translate.disabled=true
|
||||
f.output.value=""
|
||||
gftranslate.translate(f.input.value,f.from.value,f.to.value,showit)
|
||||
function step3(text) { unlextext(text,showit) }
|
||||
function step2(text) {
|
||||
gftranslate.translate(text,f.from.value,f.to.value,step3)
|
||||
}
|
||||
lextext(f.input.value,step2)
|
||||
return false;
|
||||
}
|
||||
|
||||
function wcswap() {
|
||||
var f=document.forms[0]
|
||||
f.input.value=f.output.value;
|
||||
var from=f.from.value
|
||||
f.from.value=f.to.value
|
||||
f.to.value=from
|
||||
wctranslate()
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user