-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimport_text_en_1200.php
207 lines (179 loc) · 8.83 KB
/
import_text_en_1200.php
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?php
//setlocale(LC_ALL, "en_GB.UTF-8");
header('Content-Type: text/html; charset=utf8');
include("./includes/fns.php");
$to_be_checked=$_POST['to_be_checked'];
// truncate the text input to 900 characters first, to stop people faffing about
$to_be_checked=strip_tags(substr($to_be_checked,0,900));
/******************************** ILAZKI ***************************************/
// On ilazki we need to change the following line to include stripslashes:
// $to_be_checked=trim(stripslashes($to_be_checked));
/******************************** ILAZKI ***************************************/
$to_be_checked=trim($to_be_checked);
// add a period at the end of the text if it is not already there, or if there is no ! or ? there
// otherwise the segmentation into sentences won't work
if (preg_match("/[.!?]$/", $to_be_checked) || empty($to_be_checked))
{
$to_be_checked=$to_be_checked;
}
else
{
$to_be_checked=$to_be_checked.".";
}
/******************************** ILAZKI ***************************************/
// The ilazki server has a slightly odd setup. It seems to be using addslashes, ISO-8859, and short tags for php.
// Thebash shell is set to POSIX, so we need to change encoding before launching a new instance
// otherwise things like ô, ŷ etc will not be passed through correctly, hence the "export LANG=en_GB.utf8 &&"
// in the commands below. For deployment, change "kevin" in the path below to "donnek".
// Note also the need to add stripslashes() above and below.
/******************************** ILAZKI ***************************************/
file:///home/kevin/public_html/interface/import_text_en_1200.php
$bin_path="/home/kevin/local/bin/";
$lib_path="LD_LIBRARY_PATH=/home/kevin/local/lib";
$share_path="/home/kevin/local/share/apertium/apertium-cy-en/";
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<title>Agoriad-cy - check output from apertium-cy</title>
<link rel="stylesheet" href="agoriad1200.css" type="text/css" media="screen, projection">
<!--[if IE]><link rel="stylesheet" href="ie.css" type="text/css" media="screen, projection"><![endif]-->
<script type="text/javascript" src="accordion/javascript/prototype.js"></script>
<script type="text/javascript" src="accordion/javascript/effects.js"></script>
<script type="text/javascript" src="accordion/javascript/accordion.js"></script>
<script type="text/javascript" src="agoriad.js"></script>
</head>
<body>
<!--Container for content-->
<div class="container">
<div class="span-7 colborder">
<form id="textform" action="import_text_en_1200.php" method="POST">
<!--
/******************************** ILAZKI ***************************************/
// On ilazki we need to change the following line to include stripslashes:
// <textarea name="to_be_checked"><?php echo $to_be_checked; ?></textarea><br />
/******************************** ILAZKI ***************************************/
-->
<textarea name="to_be_checked"><?php echo $to_be_checked; ?></textarea><br />
<input type="submit" name="submit" value="Translate!">
</form>
<br />
</div>
<div class="span-15 last">
<h1>agoriad-cy 0.1</h1>
<p><span class="alt">Agoriad</span> is a browser-based viewer for the output at different stages of Apertium processing. This install is aimed at <span class="alt">apertium-cy</span> (the Apertium Welsh-English translator), but it could be easily adapted to reflect the processing stages in other Apertium pairs. Several variants (<a href="import_text_en_950.php">950px</a>, <a href="import_text_en_1200.php">1200px</a>, <a href="import_text_en_1600.php">1600px</a>) allow for different widths of screens - wider screens allow more processing stages to be compared simultaneously. <span class="alt">Agoriad</span> would not have been possible without Fran Tyers (for advice on Apertium), Olav Bjorkoy's <span class="alt"><a href="http://www.blueprintcss.org">blueprint-css</a></span> and Kevin Miller's <span class="alt"><a href="http://stickmanlabs.com/accordion">Accordion</a></span>. To test, try typing <span class="alt">Mae'r gath yn yr ardd</span> (<em>The cat is in the garden</em>) into the box.</p>
</div>
<hr />
<div class="span-24">
<!--lt-proc-->
<div id="horizontal_container1" >
<p class="horizontal_accordion_toggle">1<br /> <br />l<br />t<br />-<br />p<br />r<br />o<br />c<br /></p>
<div class="horizontal_accordion_content">
<p>
<?php
$lt_proc_output=exec('export LANG=en_GB.utf8 && echo "' . $to_be_checked . '" | ' . $bin_path."lt-proc " . $share_path."cy-en.automorf.bin", $ltproc);
include("ltproc.php");
?>
</p>
</div>
</div>
<!--cg-proc-->
<div id="horizontal_container2" >
<p class="horizontal_accordion_toggle">2<br /> <br />c<br />g<br />-<br />p<br />r<br />o<br />c<br /></p>
<div class="horizontal_accordion_content">
<p>
<?php
$cg_proc_output=exec('export LANG=en_GB.utf8 && echo "' . $lt_proc_output . '" | ' . $bin_path."cg-proc " . $share_path."cy-en.cg.bin", $cgproc);
include("cgproc.php");
?>
</p>
</div>
</div>
<!--tagger-->
<div id="horizontal_container3" >
<p class="horizontal_accordion_toggle">3<br /> <br />t<br />a<br />g<br />g<br />e<br />r<br /></p>
<div class="horizontal_accordion_content">
<p>
<?php
$tagger_output=exec('export LANG=en_GB.utf8 && echo "' . $cg_proc_output . '" | ' . $bin_path."apertium-tagger -g " . $share_path."cy-en.prob", $tagger);
include("tagger.php");
?>
</p>
</div>
</div>
<!--pretransfer-->
<div id="horizontal_container4" >
<p class="horizontal_accordion_toggle">4<br /> <br />p<br />r<br />e<br />t<br />r<br />a<br />n<br />s<br />f<br />e<br />r<br /></p>
<div class="horizontal_accordion_content">
<p>
<?php
$pretransfer_output=exec('export LANG=en_GB.utf8 && echo "' . $tagger_output . '" | ' . $bin_path."apertium-pretransfer ", $pretransfer);
include("pretransfer.php");
?>
</p>
</div>
</div>
<!--transfer-->
<div id="horizontal_container5" >
<p class="horizontal_accordion_toggle">5<br /> <br />t<br />r<br />a<br />n<br />s<br />f<br />e<br />r<br /></p>
<div class="horizontal_accordion_content">
<p>
<?php
$transfer_output=exec('export LANG=en_GB.utf8 && echo "' . $pretransfer_output . '" | ' . $bin_path."apertium-transfer " . $share_path."apertium-cy-en.cy-en.t1x " . $share_path."cy-en.t1x.bin " . $share_path."cy-en.autobil.bin", $transfer);
include("transfer.php");
?>
</p>
</div>
</div>
<!--interchunk-->
<div id="horizontal_container6">
<p class="horizontal_accordion_toggle">6<br /> <br />i<br />n<br />t<br />e<br />r<br />c<br />h<br />u<br />n<br />k<br /></p>
<div class="horizontal_accordion_content">
<p>
<?php
$interchunk_output=exec('export LANG=en_GB.utf8 && echo "' . $transfer_output . '" | ' . $bin_path."apertium-interchunk " . $share_path."apertium-cy-en.cy-en.t2x " . $share_path."cy-en.t2x.bin", $interchunk);
include("interchunk.php");
?>
</p>
</div>
</div>
<!--postchunk-->
<div id="horizontal_container7">
<p class="horizontal_accordion_toggle">7<br /> <br />p<br />o<br />s<br />t<br />c<br />h<br />u<br />n<br />k<br /></p>
<div class="horizontal_accordion_content">
<p>
<?php
$postchunk_output=exec('export LANG=en_GB.utf8 && echo "' . $interchunk_output . '" | ' . $bin_path."apertium-postchunk " . $share_path."apertium-cy-en.cy-en.t3x " . $share_path."cy-en.t3x.bin" , $postchunk);
include("postchunk.php");
?>
</p>
</div>
</div>
<!--lt-proc morphological generation-->
<div id="horizontal_container8">
<p class="horizontal_accordion_toggle">8<br /> <br />l<br />t<br />-<br />p<br />r<br />o<br />c<br /></p>
<div class="horizontal_accordion_content">
<p>
<?php
$lt_proc2_output=exec('export LANG=en_GB.utf8 && echo "' . $postchunk_output . '" | ' . $bin_path."lt-proc -g " . $share_path."cy-en.autogen.bin", $ltproc2);
include("ltproc2.php");
?>
</p>
</div>
</div>
<!--lt-proc post-generation-->
<div id="horizontal_container9">
<p class="horizontal_accordion_toggle">9<br /> <br />l<br />t<br />-<br />p<br />r<br />o<br />c<br /></p>
<div class="horizontal_accordion_content">
<p>
<?php
$lt_proc3_output=exec('export LANG=en_GB.utf8 && echo "' . $lt_proc2_output . '" | ' . $bin_path."lt-proc -p " . $share_path."cy-en.autopgen.bin", $ltproc3);
include("ltproc3.php");
?>
</p>
</div>
</div>
</div>
</div> <!-- end container -->
</body>
</html>