From ec76c2c915ab02cbb06934c7dfeb109f00dcea3c Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 8 Jun 2016 15:45:58 +0200 Subject: over-engineering --- index.php | 44 +++++++++++++++++++++++++++++++++++--------- pool.php | 6 +++--- util/run_all | 3 ++- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/index.php b/index.php index 4aed520..320e653 100644 --- a/index.php +++ b/index.php @@ -3,6 +3,9 @@ Post-Editing Interface + @@ -12,10 +15,10 @@
Please enter your session key: - +     Session type:     @@ -23,10 +26,34 @@
+ + - -Assignment + + + diff --git a/pool.php b/pool.php index ad8de29..bce819c 100644 --- a/pool.php +++ b/pool.php @@ -11,7 +11,7 @@ -

Click on a table cell, enter your name, and click 'Begin' to begin your session. Reload the page if you clicked on the wrong cell.

+

Click on a table cell, enter your name, and click 'Begin' to begin your session. Reload the page if you clicked on the wrong cell or if the session is already used by someone else.

#0
@@ -41,8 +41,8 @@ $max = $j; } } - fclose($f); - + fclose($f); + for ($i=1; $i<=$max; $i++) { echo "#".$i."
".$b[$i]."\n"; if ($i%5 == 0) { diff --git a/util/run_all b/util/run_all index 2fc511c..801d553 100755 --- a/util/run_all +++ b/util/run_all @@ -1,6 +1,7 @@ #!/bin/zsh -x -for i in `find ../sessions -maxdepth 1 | cut -d "/" -f 3 | grep -P "^session_"`; do +#for i in `find ../sessions -maxdepth 1 | cut -d "/" -f 3 | grep -P "^sess_"`; do +for i in `cat ../sessions/sessions | cut -f 1`; do echo $i ./util/run_server $i & done -- cgit v1.2.3 From cd98012866ae69bb269789fb9158cfd19fc6948a Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 8 Jun 2016 15:46:19 +0200 Subject: summary: TER exaplanation --- views/summary.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/summary.haml b/views/summary.haml index 29dc0ad..f5ff4b3 100644 --- a/views/summary.haml +++ b/views/summary.haml @@ -9,8 +9,8 @@ %script{:src => "http://postedit.cl.uni-heidelberg.de/js/debug.js"} %body %h1 Summary - %p (Session #{session_key}) - %p Data is shown in the MT system's formatting. BLEU is calculated without smoothing. + %p.small (Session #{session_key}) + %p Data is shown in the MT system's formatting. BLEU is calculated without smoothing. TER capped at 1.0. %table %tr %td -- cgit v1.2.3 From 1064a4b2cccf0cfa38713216265e939330f4b6b5 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 8 Jun 2016 15:46:34 +0200 Subject: main.css: nicer links --- static/main.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/main.css b/static/main.css index 59f8870..49623fe 100644 --- a/static/main.css +++ b/static/main.css @@ -33,10 +33,10 @@ textarea, input { .tiny { font-size:.6em } a { - color: #ddd; + color: #000; text-decoration: underline } -a:hover { color: #000 } +a:hover { color: #ccc; text-decoration: none } div#wrapper { margin: 2em; -- cgit v1.2.3 From 5242b5b1b5991eb08c9578b299c383c604ed4f33 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 8 Jun 2016 15:46:52 +0200 Subject: summary --- interface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface.php b/interface.php index 5ea96ae..04e0af9 100644 --- a/interface.php +++ b/interface.php @@ -49,7 +49,7 @@ Note that the source word may be distorted. - + -- cgit v1.2.3 From 9f37d60789d3a3101c7634eb7baba3acdcc54e66 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 8 Jun 2016 15:47:16 +0200 Subject: server.rb: cap TER at 1.0 for summary --- server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.rb b/server.rb index e6bf258..b93464b 100755 --- a/server.rb +++ b/server.rb @@ -721,7 +721,7 @@ get '/summary' do g.write data["references"][j]+"\n" f.close g.close - ter_scores << (`#{CDEC}/mteval/fast_score -i #{f.path} -r #{g.path} -m ter 2>/dev/null`.to_f).round(2) + ter_scores << [1.0, (`#{CDEC}/mteval/fast_score -i #{f.path} -r #{g.path} -m ter 2>/dev/null`.to_f).round(2)].min f.unlink g.unlink } -- cgit v1.2.3 From c581250bc80e6bdd9ca5e8755b13904ea5b02eb2 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 8 Jun 2016 15:47:54 +0200 Subject: interface: don't send on enter, reset doesn't reset counts --- js/interface.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/interface.js b/js/interface.js index 4c9685d..ceed474 100644 --- a/js/interface.js +++ b/js/interface.js @@ -105,7 +105,7 @@ var catch_return = function (e) { if (e.keyCode == 13) { e.preventDefault(); - next(); + //next(); } return false; @@ -398,7 +398,7 @@ var request_and_process_next = function () if (data["fin"]) { target_textarea.setAttribute("disabled", "disabled"); status.style.display = "none"; - button.innerHTML = "---"; + //button.innerHTML = "-----"; $("#view_summary").toggle() $("#raw_source_textarea").html(""); $("#target_textarea").val(""); @@ -542,11 +542,11 @@ var reset = function () var ui_type = get_ui_type(); if (ui_type == "t") { if (!$("#init").val()) return; - TEXT_count_click = 0; - TEXT_count_kbd = 0; + //TEXT_count_click = 0; + //TEXT_count_kbd = 0; $("#target_textarea").val($("#original_mt").val()); } else if (ui_type == "g") { - DE_init() + DE_init(false) } } -- cgit v1.2.3 From f57095e878fa0c3ecb6192bca1d19f9fef89508c Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 8 Jun 2016 16:20:22 +0200 Subject: somewhat more secure --- inc/db.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/db.inc.php b/inc/db.inc.php index ed45f7b..7356076 100644 --- a/inc/db.inc.php +++ b/inc/db.inc.php @@ -1,7 +1,10 @@ -- cgit v1.2.3 From 182cd661d04b7a76acbb4c5653b840f511811e4d Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 8 Jun 2016 16:29:59 +0200 Subject: fix --- js/interface.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/interface.js b/js/interface.js index ceed474..0f0b9f3 100644 --- a/js/interface.js +++ b/js/interface.js @@ -115,7 +115,7 @@ var TEXT_handle_keypress = function (e) { if (e.keyCode == 13) { e.preventDefault(); - next(); + //next(); } TEXT_count_kbd += 1; -- cgit v1.2.3 From 8aff80ee4f5a3cb3627e88b95a32921e7e8d7f84 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 8 Jun 2016 16:32:53 +0200 Subject: fix help --- inc/help.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/help.inc.php b/inc/help.inc.php index c29d989..86ddf70 100644 --- a/inc/help.inc.php +++ b/inc/help.inc.php @@ -1,5 +1,6 @@ -

Press the 'Next' button to submit your post-edit and to request the next segment for post-edition. -In the textual interface, you may just press return when the post-edit is finished (and 'Target' text area is in focus).

+

Press the 'Next' button to submit your translation or post-edit and to request the next segment for post-edition. + +

The session can be paused at any time and continued later -- just press 'Pause'. Note that we are collecting timing information, so pausing your session on inactivity is important for us. You may also just reload this site upon your return and re-request the segment to reset the timer.

-- cgit v1.2.3 From 1a51b3797d4c3a846e47b105a5edcb8283726651 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Tue, 14 Jun 2016 13:15:10 +0200 Subject: submit name, some fixes --- inc/db.inc.php | 2 +- index.php | 20 ++++++++++++++------ interface.php | 1 + js/interface.js | 1 + server.rb | 4 ++++ util/run_all | 1 + 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/inc/db.inc.php b/inc/db.inc.php index 7356076..e023c3a 100644 --- a/inc/db.inc.php +++ b/inc/db.inc.php @@ -2,7 +2,7 @@ $SESSION_DIR="/srv/postedit/sessions"; $key = $_GET["key"]; -if (preg_match('/^[a-z0-9]{4}$/', $key)) { +if (preg_match('/^[a-z0-9]{1,4}$/', $key)) { $json = file_get_contents($SESSION_DIR."/".$key."/data.json"); } $db = json_decode($json); diff --git a/index.php b/index.php index 320e653..4b7e13c 100644 --- a/index.php +++ b/index.php @@ -4,7 +4,13 @@ Post-Editing Interface @@ -13,16 +19,18 @@ -
- Please enter your session key: + + Session key: -     Session type: +     Name: + +     Session type:     - +
diff --git a/js/interface.js b/js/interface.js index 0f0b9f3..b86bf50 100644 --- a/js/interface.js +++ b/js/interface.js @@ -286,6 +286,7 @@ var next = function () } send_data["key"] = key; + send_data["name"] = $("#name").val(); // send data if (oov_correct.value=="false" && post_edit != "") { diff --git a/server.rb b/server.rb index b93464b..d25e216 100755 --- a/server.rb +++ b/server.rb @@ -179,6 +179,10 @@ def process_next reply return end $lock = true # lock + if !data['name'] || data['name'] == "" + $status = "Error: Name not given." + return + end if data['key'] != SESSION_KEY $status = "Error: Key mismatch (#{data['key']}, #{SESSION_KEY})" return diff --git a/util/run_all b/util/run_all index 801d553..ef3386a 100755 --- a/util/run_all +++ b/util/run_all @@ -4,5 +4,6 @@ for i in `cat ../sessions/sessions | cut -f 1`; do echo $i ./util/run_server $i & + sleep 15 done -- cgit v1.2.3