1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
<html>
<head>
<meta charset="utf-8" />
<title>Post-editing application</title>
</head>
<body onload="alertmessage()">
<script type="text/javascript">
var count= 1;
var count1;
// welcome message
function alertmessage()
{
alert("Welcome to Post-editing app! \n Good luck! =) ");
}
document.write("Please correct the machine translation from German to English.")
document.writeln("<br >");
document.writeln("<br >");
function GetSourceData()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("src").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST","server_js1.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("number="+count);
}
function GetTargetData()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById('trgt').value= xmlhttp.responseText;
}
}
xmlhttp.open("POST","server_js1.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("number_trgt="+count);
}
function SubmitData()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
alert("Thank you for your submission: " +xmlhttp.responseText);
}
}
xmlhttp.open("POST","server_js1.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("postedit="+document.getElementById('trgt').value);
}
function SubmitAndGetData()
{
SubmitData();
GetSourceData();
GetTargetData();
count++;
}
function GetTargetDataAgain()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById('trgt').value= xmlhttp.responseText;
}
}
xmlhttp.open("POST","server_js1.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
if (count==1)
{
count1 = -5;
}
else
{
count1 = count -1;
}
xmlhttp.send("number_trgt="+count1);
}
</script>
<h3>There is a source sentence.</h3>
<form action="textarea.htm">
<textarea id="src" style="font-size: 20px" name="source" cols="130" rows="2" readonly><?php $mySourceFile = fopen("source.txt", "r") or die("Unable to open file!");
echo fgets($mySourceFile);
fclose($mySourceFile);
?></textarea>
</form><br><br/>
<h3>Please post-edit the SMT output.</h3>
<form action="textarea.htm">
<textarea id="trgt" style="font-size: 20px" name="target" cols="130" rows="2"><?php
$myTargetFile = fopen("target.txt", "r") or die("Unable to open file!");
$SMToutput = fgets($myTargetFile);
echo $SMToutput;
fclose($myTargetFile);
?></textarea><br><br/>
</form>
<button type="button" onclick="GetTargetDataAgain()">Revert to SMT output</button>
<button type="button" onclick="SubmitAndGetData()">Submit postedit</button>
</body>
</html>
|