summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-12-11 17:06:50 +0100
committerPatrick Simianer <p@simianer.de>2015-12-11 17:06:50 +0100
commitc273faedee7b0c73945dfd8fdab15d655b6c4f3a (patch)
tree03024cde8ff1c622a2a2f23d70696411b0af8847
parent7c179958222b95939ff1881a49126e08a38d489e (diff)
save original view as svg
-rw-r--r--interface.php1
-rw-r--r--js/debug.js8
-rw-r--r--js/lfpe.js3
-rwxr-xr-xphrase2_extraction/phrase2_extraction.rb4
-rwxr-xr-xserver.rb2
-rw-r--r--static/debug.css2
-rw-r--r--views/debug.haml8
7 files changed, 18 insertions, 10 deletions
diff --git a/interface.php b/interface.php
index baf1768..a459b15 100644
--- a/interface.php
+++ b/interface.php
@@ -125,5 +125,6 @@ foreach($db->raw_source_segments as $s) {
<textarea style="display:none" id="init">0</textarea>
<textarea style="display:none" id="ui_type"><?php echo $_GET["ui_type"]; ?></textarea>
<textarea style="display:none" id="data"></textarea>
+<textarea style="display:none" id="original_svg"></textarea>
<!-- /Data -->
diff --git a/js/debug.js b/js/debug.js
index 4ff95de..e54d3f1 100644
--- a/js/debug.js
+++ b/js/debug.js
@@ -5,12 +5,14 @@ $().ready(function()
$(this).click(function(){
$.ajax({url: $(this).attr("tgt"), success: function(result){
$("#control_reply").html(result);
- }});
+ }});
})
})
-
+
// display svg
- var d = atob(document.getElementById("svg_b64").innerHTML);
+ var d = atob(document.getElementById("svg_b64").innerHTML);
$('#svg').append($('<svg width="10000px">'+d+'</svg>'));
+ d = atob(document.getElementById("original_svg_b64").innerHTML);
+ $('#original_svg').append($('<svg width="10000px">'+d+'</svg>'));
});
diff --git a/js/lfpe.js b/js/lfpe.js
index 4c7dc72..9185018 100644
--- a/js/lfpe.js
+++ b/js/lfpe.js
@@ -177,6 +177,7 @@ function Next()
post_edit = "";
send_data["post_edit"] = encodeURIComponent(post_edit);
send_data['type'] = 'g';
+ send_data["original_svg"] = document.getElementById("original_svg").value;
} else {
post_edit = trim(target_textarea.value);
send_data["post_edit"] = post_edit;
@@ -186,7 +187,6 @@ function Next()
send_data["key"] = key;
// send data
- // ???
if (oov_correct.value=="false" && post_edit != "") {
send_data["EDIT"] = true;
send_data["duration"] = Timer.get();
@@ -362,6 +362,7 @@ function Next()
DE_init();
var x = trim(JSON.parse(DE_extract_data())["target"].join(" "));
last_post_edit.value = x;
+ document.getElementById("original_svg").value = DE_get_raw_svg_data();
}
// start timer
diff --git a/phrase2_extraction/phrase2_extraction.rb b/phrase2_extraction/phrase2_extraction.rb
index 8f09a8b..8352c2a 100755
--- a/phrase2_extraction/phrase2_extraction.rb
+++ b/phrase2_extraction/phrase2_extraction.rb
@@ -300,7 +300,7 @@ class Rule
j = 0
fl.each { |i|
if i.match(/\[NEWX,\d+\]/)
- STDERR.write "j = #{j}\n"
+ STDERR.write "j = #{j}\n" if DEBUG
start_correct_source = j
break
end
@@ -322,7 +322,7 @@ class Rule
j = 0
el.each { |i|
if i.match(/\[NEWX,\d+\]/)
- STDERR.write "j = #{j}\n"
+ STDERR.write "j = #{j}\n" if DEBUG
start_correct_target = j
break
end
diff --git a/server.rb b/server.rb
index 88f8c9a..48052ca 100755
--- a/server.rb
+++ b/server.rb
@@ -241,6 +241,7 @@ post '/next' do # (receive post-edit, update models), send next translation
$db['feedback'] << reply
$db['post_edits_raw'] << post_edit
$db['svg'] << data['svg']
+ $db['original_svg'] << data['original_svg']
$db['durations'] << data['duration'].to_f
$db['post_edits_display'] << send_recv(:detokenizer, post_edit)
# 1. tokenize
@@ -480,6 +481,7 @@ get '/reset_progress' do # reset current session
$db['derivations'].clear
$db['derivations_proc'].clear
$db['svg'].clear
+ $db['original_svg'].clear
$db['feedback'].clear
$db['progress'] = -1
update_database true
diff --git a/static/debug.css b/static/debug.css
index e235a82..d5291e8 100644
--- a/static/debug.css
+++ b/static/debug.css
@@ -7,5 +7,5 @@ td.noborder { border:0 }
td.left { text-align:left }
a { color:blue }
h1,h2 { background:#fff; padding:.25em }
-#svg_b64 { display:none }
+#svg_b64,#original_svg_b64 { display:none }
diff --git a/views/debug.haml b/views/debug.haml
index 1cda494..6d6a42c 100644
--- a/views/debug.haml
+++ b/views/debug.haml
@@ -56,7 +56,9 @@
%hr
/=#########################################################################
%h2#post_edit Post-edit &amp; machine translation
+ %p#original_svg_b64 #{data["original_svg"][progress]}
%p#svg_b64 #{data["svg"][progress]}
+ %div#original_svg
%div#svg
%table
%tr
@@ -93,9 +95,9 @@
%td.left #{pairwise_ranking_data["best_match"]}
%h2 Derivation
%pre #{data["derivations"][progress]}
- %h3 Processed
- - if data["derivations_proc"][progress]
- %pre #{JSON.pretty_generate(JSON.parse(data["derivations_proc"][progress]))}
+ /= %h3 Processed
+ /= - if data["derivations_proc"][progress]
+ /= %pre #{JSON.pretty_generate(JSON.parse(data["derivations_proc"][progress]))}
%h2 Client reply
- if data["feedback"][progress]
%pre #{JSON.pretty_generate(JSON.parse(data["feedback"][progress]))}