-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathalignment.php
executable file
·78 lines (70 loc) · 2.83 KB
/
alignment.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
<?php
/* Copyright (c) 2010-2017 Pavel Vondřička (Pavel.Vondricka@korpus.cz)
* Copyright (c) 2010-2017 Charles University in Prague, Faculty of Arts,
* Institute of the Czech National Corpus
*
* This file is part of InterText Server.
*
* InterText Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* InterText Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with InterText Server. If not, see <http://www.gnu.org/licenses/>.
*
*/
set_time_limit(9999);
require 'init.php';
require 'lib_intertext.php';
$system = new InterText;
print "Process: Creating alignment...\nProgress: 0\n"; flush(); ob_flush();
if ($_SESSION['realign']) {
$res = $aid = $_COOKIE['InterText_aid'];
} else {
#$v1 = $system->txtver_by_id($_COOKIE['InterText_txt'],$_SESSION['al_ver1']);
#$v2 = $system->txtver_by_id($_COOKIE['InterText_txt'],$_SESSION['al_ver2']);
#$aid = $system->insert_alignment($v1['text_id'],$v1['id'],$v2['id'],$_SESSION['al_method'],$_SESSION['al_profile'],$USER['id']);
$aid = $system->insert_alignment($_COOKIE['InterText_txt'],$_SESSION['al_ver1'],$_SESSION['al_ver2'],$_SESSION['al_method'],$_SESSION['al_profile'],$USER['id'],0,$DEFAULT_EDIT_PERMISSION);
$defstat = $_SESSION['al_default_status'];
$res = $aid;
}
if (!$res) { print "Process: Creating alignment...<br />ERROR: These versions have already an open alignment!\n\n"; flush(); ob_flush(); }
else {
# Import alignment from file, if any
if ($res AND $_SESSION['al_file']!='')
$res = $system->import_alignment($_SESSION['al_file'],$aid,$defstat,TRUE,FALSE);
if ($res) {
# Run automatic aligner as requested
switch ($_SESSION['al_method']) {
case "tca2":
$res = $system->autoalign_tca2($aid,$_SESSION['al_profile']);
break;
case "hunalign":
$res = $system->autoalign_hunalign($aid,$_SESSION['al_profile']);
break;
default:
$res = $system->plain_alignment($aid);
}
}
# Create plain alignment for the rest
#if ($res) $system->plain_alignment($aid);
# In case of failure...
if (!$res) {
if (!$_SESSION['realign']) $system->delete_alignment($aid);
} else print "Process: Finished.\n";
}
if ($_SESSION['al_file']!='') unlink($_SESSION['al_file']);
unset($_SESSION['realign']);
unset($_SESSION['al_file']);
unset($_SESSION['al_ver1']);
unset($_SESSION['al_ver2']);
unset($_SESSION['al_method']);
unset($_SESSION['al_profile']);
unset($_SESSION['al_default_status']);
?>