summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-04-14 10:44:57 +0200
committerPatrick Simianer <p@simianer.de>2015-04-14 10:44:57 +0200
commitaa97f229d6a6a1e5bc2bd133d0d39eefff888566 (patch)
tree6e9db365c0fa881fb5804366e18dbc6ce8d05696
parentb72fcb0fec707a9c829634e24d333f36e24116ae (diff)
submit on keypress
-rw-r--r--index.php12
-rw-r--r--lfpe.css14
-rw-r--r--lfpe.js16
-rw-r--r--model/grammar.gzbin121 -> 153 bytes
-rwxr-xr-xmodel/run9
-rw-r--r--model/src.gzbin70 -> 128 bytes
-rw-r--r--server.rb4
7 files changed, 49 insertions, 6 deletions
diff --git a/index.php b/index.php
index ef1574e..7439c91 100644
--- a/index.php
+++ b/index.php
@@ -8,22 +8,32 @@
<body onload="Next()">
+<div id="wrapper">
+
<div>
<textarea id="src" name="source" cols="1" rows="1" readonly></textarea>
</div>
<div>
- <textarea id="trgt" name="target" cols="1" rows="1"></textarea>
+ <textarea id="trgt" name="target" cols="1" rows="1" onkeypress="submit(event)"></textarea>
</div>
<p>
<button id="next" type="button" onclick="Next()">Next</button>
</p>
+</div>
+
<p id="translating_status">
<strong>translating</strong> <img src="img/ajax-loader-large.gif" width="20px" />
</p>
+<p id="desc">
+Press the 'Next' to submit your post-edit and request the next segment to translate
+(or just press enter when the textarea is in focus).
+</p>
+
+
</body>
</html>
diff --git a/lfpe.css b/lfpe.css
index b7959fa..91b8c3a 100644
--- a/lfpe.css
+++ b/lfpe.css
@@ -4,6 +4,8 @@ textarea {
p#translating_status {
display: none;
+ margin-left: 4.2em;
+ margin-top: -5.5em
}
button {
@@ -17,3 +19,15 @@ p#fi {
display: none;
}
+div#wrapper {
+ margin: 4em;
+ padding: 1em;
+ border: 1px dashed #000
+}
+
+p#desc {
+ font-size:0.8em;
+ color: #ccc;
+ position: fixed
+}
+
diff --git a/lfpe.js b/lfpe.js
index 4bbbcee..bf7aa0e 100644
--- a/lfpe.js
+++ b/lfpe.js
@@ -14,9 +14,18 @@ function CreateCORSRequest(method, url) {
return xhr;
}
-function Next(url)
+function submit(e) {
+ if (e.keyCode == 13) {
+ e.preventDefault();
+ Next();
+ }
+
+ return false;
+}
+
+function Next()
{
- url = "http://localhost:31337/next";
+ url = "http://coltrane.cl.uni-heidelberg.de:60666/next";
var pe = document.getElementById("trgt").value;
if (pe != "") {
var src = document.getElementById("src").value;
@@ -43,6 +52,9 @@ function Next(url)
document.getElementById("trgt").value = x[1];
document.getElementById("trgt").cols = x[1].length;
document.getElementById("translating_status").style.display = "none";
+ document.getElementById("trgt").focus();
+ document.getElementById("trgt").selectionStart = 0;
+ document.getElementById("trgt").selectionEnd = 0;
}
};
diff --git a/model/grammar.gz b/model/grammar.gz
index 84eb73c..8c5f570 100644
--- a/model/grammar.gz
+++ b/model/grammar.gz
Binary files differ
diff --git a/model/run b/model/run
index 43f20b0..2ab2498 100755
--- a/model/run
+++ b/model/run
@@ -1,4 +1,11 @@
#!/bin/bash -x
-~/src/cdec_net/training/dtrain/dtrain_net_interface -c dtrain.ini -a ipc:///tmp/dtrain.ipc
+export LD_LIBRARY_PATH=/fast_scratch/simianer/lfpe/nanomsg-0.5-beta/lib
+
+while true; do
+/fast_scratch/simianer/lfpe/cdec_net/training/dtrain/dtrain_net_interface -c dtrain.ini -a ipc:///tmp/dtrain.ipc &>dtrain.out &
+PID=$!
+sleep 600
+kill $PID
+done
diff --git a/model/src.gz b/model/src.gz
index 9aa247f..3f8f895 100644
--- a/model/src.gz
+++ b/model/src.gz
Binary files differ
diff --git a/server.rb b/server.rb
index fac51d1..def401e 100644
--- a/server.rb
+++ b/server.rb
@@ -5,8 +5,8 @@ require 'sinatra/cross_origin'
require 'nanomsg'
require 'zipf'
-set :bind, '0.0.0.0'
-set :port, 31337
+set :bind, '147.142.207.52'
+set :port, 60666
set :allow_origin, :any
set :allow_methods, [:get, :post, :options]