diff options
-rw-r--r-- | index.php | 93 | ||||
-rw-r--r-- | js/pool.js | 29 | ||||
-rwxr-xr-x | phrase2_extraction/phrase2_extraction.rb | 5 | ||||
-rw-r--r-- | pool.php | 62 | ||||
-rw-r--r-- | pool_save.php | 25 | ||||
-rwxr-xr-x | server.rb | 2 | ||||
-rw-r--r-- | static/pool.css | 14 | ||||
-rw-r--r-- | static/pool.html | 36 | ||||
-rwxr-xr-x | util/kill | 2 | ||||
-rwxr-xr-x | util/run_all | 7 | ||||
-rwxr-xr-x | util/run_demo | 4 |
11 files changed, 264 insertions, 15 deletions
@@ -18,23 +18,90 @@ <option value="g">graphical</option> <option value="t">text</option> </select> - + <input type="submit" value="Submit" /> </form> -<div class="small" style="background:#eee;margin: 5em 0 5em 0;padding:.5em; max-width:10%"> +<!--<div class="small" style="background:#eee;margin: 5em 0 5em 0;padding:.5em; max-width:25%"> <p>Select: <select class="small"> - <option value="final_model_en-de_g0" onclick="document.getElementById('key').value=this.value;">0</option> - <option value="final_model_en-de_g1" onclick="document.getElementById('key').value=this.value;">1</option> - <option value="final_model_en-de_g2" onclick="document.getElementById('key').value=this.value;">2</option> - <option value="final_model_en-de_g3" onclick="document.getElementById('key').value=this.value;">3</option> - <option value="final_model_en-de_g4" onclick="document.getElementById('key').value=this.value;">4</option> - <option value="final_model_en-de_g5" onclick="document.getElementById('key').value=this.value;">5</option> - <option value="final_model_en-de_g6" onclick="document.getElementById('key').value=this.value;">6</option> + <option value="g0_0_nomt" onclick="document.getElementById('key').value=this.value;">#0 (from scratch)</option> + <option value="g0_0_pe" onclick="document.getElementById('key').value=this.value;">#0 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_1_nomt" onclick="document.getElementById('key').value=this.value;">#1 (from scratch)</option> + <option value="g0_1_pe" onclick="document.getElementById('key').value=this.value;">#1 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_2_nomt" onclick="document.getElementById('key').value=this.value;">#2 (from scratch)</option> + <option value="g0_2_pe" onclick="document.getElementById('key').value=this.value;">#2 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_3_nomt" onclick="document.getElementById('key').value=this.value;">#3 (from scratch)</option> + <option value="g0_3_pe" onclick="document.getElementById('key').value=this.value;">#3 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_4_nomt" onclick="document.getElementById('key').value=this.value;">#4 (from scratch)</option> + <option value="g0_4_pe" onclick="document.getElementById('key').value=this.value;">#4 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_5_nomt" onclick="document.getElementById('key').value=this.value;">#5 (from scratch)</option> + <option value="g0_5_pe" onclick="document.getElementById('key').value=this.value;">#5 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_6_nomt" onclick="document.getElementById('key').value=this.value;">#6 (from scratch)</option> + <option value="g0_6_pe" onclick="document.getElementById('key').value=this.value;">#6 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_7_nomt" onclick="document.getElementById('key').value=this.value;">#7 (from scratch)</option> + <option value="g0_7_pe" onclick="document.getElementById('key').value=this.value;">#7 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_8_nomt" onclick="document.getElementById('key').value=this.value;">#8 (from scratch)</option> + <option value="g0_8_pe" onclick="document.getElementById('key').value=this.value;">#8 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_9_nomt" onclick="document.getElementById('key').value=this.value;">#9 (from scratch)</option> + <option value="g0_9_pe" onclick="document.getElementById('key').value=this.value;">#9 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_10_nomt" onclick="document.getElementById('key').value=this.value;">#10 (from scratch)</option> + <option value="g0_10_pe" onclick="document.getElementById('key').value=this.value;">#10 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_11_nomt" onclick="document.getElementById('key').value=this.value;">#11 (from scratch)</option> + <option value="g0_11_pe" onclick="document.getElementById('key').value=this.value;">#11 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_12_nomt" onclick="document.getElementById('key').value=this.value;">#12 (from scratch)</option> + <option value="g0_12_pe" onclick="document.getElementById('key').value=this.value;">#12 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_13_nomt" onclick="document.getElementById('key').value=this.value;">#13 (from scratch)</option> + <option value="g0_13_pe" onclick="document.getElementById('key').value=this.value;">#13 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_14_nomt" onclick="document.getElementById('key').value=this.value;">#14 (from scratch)</option> + <option value="g0_14_pe" onclick="document.getElementById('key').value=this.value;">#14 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_15_nomt" onclick="document.getElementById('key').value=this.value;">#15 (from scratch)</option> + <option value="g0_15_pe" onclick="document.getElementById('key').value=this.value;">#15 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_16_nomt" onclick="document.getElementById('key').value=this.value;">#16 (from scratch)</option> + <option value="g0_16_pe" onclick="document.getElementById('key').value=this.value;">#16 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_17_nomt" onclick="document.getElementById('key').value=this.value;">#17 (from scratch)</option> + <option value="g0_17_pe" onclick="document.getElementById('key').value=this.value;">#17 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_18_nomt" onclick="document.getElementById('key').value=this.value;">#18 (from scratch)</option> + <option value="g0_18_pe" onclick="document.getElementById('key').value=this.value;">#18 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_19_nomt" onclick="document.getElementById('key').value=this.value;">#19 (from scratch)</option> + <option value="g0_19_pe" onclick="document.getElementById('key').value=this.value;">#19 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_20_nomt" onclick="document.getElementById('key').value=this.value;">#20 (from scratch)</option> + <option value="g0_20_pe" onclick="document.getElementById('key').value=this.value;">#20 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_21_nomt" onclick="document.getElementById('key').value=this.value;">#21 (from scratch)</option> + <option value="g0_21_pe" onclick="document.getElementById('key').value=this.value;">#21 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_22_nomt" onclick="document.getElementById('key').value=this.value;">#22 (from scratch)</option> + <option value="g0_22_pe" onclick="document.getElementById('key').value=this.value;">#22 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_23_nomt" onclick="document.getElementById('key').value=this.value;">#23 (from scratch)</option> + <option value="g0_23_pe" onclick="document.getElementById('key').value=this.value;">#23 (post-editing)</option> +<optgroup label="________________"></optgroup> + <option value="g0_24_nomt" onclick="document.getElementById('key').value=this.value;">#24 (from scratch)</option> + <option value="g0_24_pe" onclick="document.getElementById('key').value=this.value;">#24 (post-editing)</option>--> -<!--<optgroup label="________________"> +<!--<optgroup label="________________________"> <option value="product_de-en_toy_example" onclick="document.getElementById('key').value=this.value;">toy example</option> </optgroup>--> @@ -66,9 +133,11 @@ <option value="product_en-de_beta_test_1_D" onclick="document.getElementById('key').value=this.value;">D* en-de</option> </optgroup>--> -</select> +<!--</select> </p> -</div> +</div>--> + +<a style="font-size:1.2em;color:#000" href="pool.php">Assignment</a> <?php include("inc/footer.inc.php"); ?> diff --git a/js/pool.js b/js/pool.js new file mode 100644 index 0000000..4cb2af8 --- /dev/null +++ b/js/pool.js @@ -0,0 +1,29 @@ +var ids = []; +var clicked = false; +var clicked_sess = ""; + +$().ready(function() +{ + $(".item").click(function () { + var id = $(this).attr("id"); + if (!ids.includes(id) && !clicked) { + $(this).append("<input id='name' />"); + ids.push(id); + clicked = true; + clicked_sess = $(this).attr("session"); + } + }); + + $("#button").click(function () { + if (!clicked) return; + if ($("#name").val()=="") return; + $.ajax({url: "pool_save.php?name="+encodeURIComponent($("#name").val())+"&session="+encodeURIComponent(clicked_sess), success: function(result){ + if (result=="ok") { + window.location = "http://postedit.cl.uni-heidelberg.de/interface.php?key="+clicked_sess+"&ui_type=t"; // FIXME + } else { + alert("Session taken, choose another session."); + } + }}); + }); +}); + diff --git a/phrase2_extraction/phrase2_extraction.rb b/phrase2_extraction/phrase2_extraction.rb index 01bdae9..1f268cd 100755 --- a/phrase2_extraction/phrase2_extraction.rb +++ b/phrase2_extraction/phrase2_extraction.rb @@ -7,7 +7,7 @@ module PhrasePhraseExtraction DEBUG = false MAX_NT = 1 # Chiang: 2 MAX_SEED_NUM_WORDS = 3 # Chiang: 10 words, -> phrases! -MAX_SRC_SZ = 7 # Chiang: 5 words, -> words! +MAX_SRC_SZ = 8 # Chiang: 5 words, -> words! FORBID_SRC_ADJACENT_SRC_NT = true # Chiang:true class Rule @@ -649,6 +649,8 @@ def PhrasePhraseExtraction.remove_adjacent_nt rules prev = false end } + b +=begin c = false prev = false r.target.each { |i| @@ -663,6 +665,7 @@ def PhrasePhraseExtraction.remove_adjacent_nt rules end } b || c +=end } end diff --git a/pool.php b/pool.php new file mode 100644 index 0000000..ad8de29 --- /dev/null +++ b/pool.php @@ -0,0 +1,62 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + + <title>Pool</title> + + <link rel='stylesheet' type='text/css' href='static/pool.css' /> + <script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script> + <script src="js/pool.js" type="text/javascript" charset="utf-8"></script> +</head> + +<body> + <p style='margin:2em;color:#000'><strong>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.</strong></p> + <table border=1 style="margin-left:10%"> + <tr><td>#0</td></tr> + </table> + <br /> + <br /> + <br /> + <br /> + <center> + <table border=1> + <tr> + +<!--<tr><td>#1</td><td>#2</td><td>#3</td><td>#4</td><td>#5</td></tr> + <tr><td>#6</td><td>#7</td><td>#8</td><td>#9</td><td>#10</td></tr> + <tr><td>#11</td><td>#12</td><td>#13</td><td>#14</td><td>#15</td></tr> + <tr><td>#16</td><td>#17</td><td>#18</td><td>#19</td><td>#20</td></tr> + <tr><td>#21</td><td>#22</td><td>#23</td><td>#24</td><td>#25</td></tr>--> + + <?php + $f = fopen("../sessions/sessions", "r"); + $b = array(); + $max = -1; + while (($line = fgets($f)) !== false) { + $x = explode("\t", $line, 2); + $j = intval($x[0]); + $b[$j] = trim($x[1]); + if ($j>$max) { + $max = $j; + } + } + fclose($f); + + for ($i=1; $i<=$max; $i++) { + echo "<td class='item' session='".$b[$i]."' id='item".$i."'>#".$i."<br /><span style='font-size:.5em'>".$b[$i]."</span></td>\n"; + if ($i%5 == 0) { + echo "</tr><tr>\n"; + } + } + ?> + + </tr> + </table> + + <button style="font-size:2em;margin:2em" id="button">Begin</button> + + </center> +</body> +</html> + diff --git a/pool_save.php b/pool_save.php new file mode 100644 index 0000000..5d67a25 --- /dev/null +++ b/pool_save.php @@ -0,0 +1,25 @@ +<?php + +if (!$_GET['session'] || !$_GET['name']) { + echo "empty"; + return; +} + +$f = fopen(tempnam("../tmp", "assignment-"), "wa"); + +fwrite($f,urldecode($_GET["name"])."\n"); +fwrite($f,urldecode($_GET["session"])."\n"); +fwrite($f,getdate()[0]."\n"); +fclose($f); + +$checkf = "../tmp/".urldecode($_GET["session"]); +if (file_exists($checkf)) { + echo "notok"; +} else { + $g = fopen($checkf, "wa"); + fwrite($g, "x\n"); + fclose($g); + echo "ok"; +} + +?> @@ -180,7 +180,7 @@ def process_next reply end $lock = true # lock if data['key'] != SESSION_KEY - $status = "Error: Key mismatch" + $status = "Error: Key mismatch (#{data['key']}, #{SESSION_KEY})" return end if data["OOV"] # OOV corrections diff --git a/static/pool.css b/static/pool.css new file mode 100644 index 0000000..98fde49 --- /dev/null +++ b/static/pool.css @@ -0,0 +1,14 @@ +body { background: #fff; color: #fff} + +td { + background:#eee; + color: #000; + padding: 2em; + font-weight: bold; + font-size: 1.2em; + text-align:center; +} + +td:hover { + background: #fff +} diff --git a/static/pool.html b/static/pool.html new file mode 100644 index 0000000..4e4aad3 --- /dev/null +++ b/static/pool.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- YYYY-MM-DD --> +<html> +<head> + <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> + <meta http-equiv='Content-Language' content='de_DE' /> + <meta name='author' content='Patrick Simianer' /> + <meta name='robots' content='index, follow' /> + <meta name='revisit-after' content='15 days' /> + <meta name='description' content='' /> + <meta name='keywords' content='' /> + + <title>Pool</title> + + <link rel='stylesheet' type='text/css' href='pool.css' /> +</head> + +<body> + <table border=1 style="margin-left:10%"> + <tr><td>#0</td></tr> + </table> + <br /> + <br /> + <center> + <table border=1> + <tr><td>#1</td><td>#2</td><td>#3</td><td>#4</td><td>#5</td></tr> + <tr><td>#6</td><td>#7</td><td>#8</td><td>#9</td><td>#10</td></tr> + <tr><td>#11</td><td>#12</td><td>#13</td><td>#14</td><td>#15</td></tr> + <tr><td>#16</td><td>#17</td><td>#18</td><td>#19</td><td>#20</td></tr> + <tr><td>#21</td><td>#22</td><td>#23</td><td>#24</td><td>#25</td></tr> + </table> + + </center> +</body> +</html> + @@ -1,4 +1,4 @@ #!/bin/bash -for i in {1..6}; do ps ax | grep -P "(server.rb|wrapper.rb|atools|net_fa|sa.extract|dtrain)" | grep -v vim | grep -v -P "^\s\+$" | cut -d " " -f $i | xargs kill -9 &>/dev/null; done +for i in {1..6}; do ps ax | grep -P "(server.rb|wrapper.rb|atools|net_fa|sa.extract|dtrain|truecase.perl)" | grep -v vim | grep -v -P "^\s\+$" | cut -d " " -f $i | xargs kill -9 &>/dev/null; done diff --git a/util/run_all b/util/run_all new file mode 100755 index 0000000..2fc511c --- /dev/null +++ b/util/run_all @@ -0,0 +1,7 @@ +#!/bin/zsh -x + +for i in `find ../sessions -maxdepth 1 | cut -d "/" -f 3 | grep -P "^session_"`; do + echo $i + ./util/run_server $i & +done + diff --git a/util/run_demo b/util/run_demo new file mode 100755 index 0000000..2140a1c --- /dev/null +++ b/util/run_demo @@ -0,0 +1,4 @@ +#!/bin/zsh -x + +for i in {0..24}; do for j in pe nomt; do ./util/run_server g0_"$i"_"$j" &; done; done + |