Commit 0c229d9a authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

Parallel corpora (TBC)

parent 6d496b04
......@@ -77,7 +77,7 @@
{ "id": "UD_English-GUM@2.7" },
{ "id": "UD_English-GUMReddit@2.7", "no_word": true },
{ "id": "UD_English-ParTUT@2.7" },
{ "id": "UD_English-PUD@2.7", "enhanced": true },
{ "id": "UD_English-PUD@2.7", "enhanced": true, "parallels": ["UD_French-PUD@2.7"] },
{ "id": "UD_English-LinES@2.7" },
{ "id": "UD_English-Pronouns@2.7" },
{ "id": "UD_English-EWT@2.7", "enhanced": true },
......@@ -112,7 +112,7 @@
{ "id": "UD_French-Sequoia@2.7" },
{ "id": "UD_French-FQB@2.7" },
{ "id": "UD_French-Spoken@2.7" },
{ "id": "UD_French-PUD@2.7" },
{ "id": "UD_French-PUD@2.7", "parallels": ["UD_English-PUD@2.7"] },
{ "id": "UD_French-FTB@2.7", "no_word": true }
]
},
......@@ -344,12 +344,11 @@
{ "section" : "Converted from native SUD" },
{ "id": "UD_Beja-NSC@conv" },
{ "id": "UD_French-GSD@conv" },
{ "id": "UD_French-Spoken@conv" },
{ "id": "UD_French-Paris-Stories@conv" },
{ "id": "UD_Naija-NSC@conv" },
{ "id": "UD_Beja-NSC@conv", "parallels": ["SUD_Beja-NSC@latest"] },
{ "id": "UD_French-GSD@conv", "parallels": ["SUD_French-GSD@latest"] },
{ "id": "UD_French-Spoken@conv", "parallels": ["SUD_French-Spoken@latest"] },
{ "id": "UD_French-Paris-Stories@conv", "parallels": ["SUD_French-Paris-Stories@latest"] },
{ "id": "UD_Naija-NSC@conv", "parallels": ["SUD_Naija-NSC@latest"] },
{ "section" : "GitHub dev branches" },
{ "id": "UD_English-EWT@dev" },
......@@ -371,11 +370,11 @@
"corpora":
[
{ "section" : "Native SUD" },
{ "id": "SUD_Beja-NSC@latest" },
{ "id": "SUD_French-GSD@latest" },
{ "id": "SUD_French-Spoken@latest" },
{ "id": "SUD_French-Paris-Stories@latest" },
{ "id": "SUD_Naija-NSC@latest" },
{ "id": "SUD_Beja-NSC@latest", "parallels": ["UD_Beja-NSC@conv"] },
{ "id": "SUD_French-GSD@latest", "parallels": ["UD_French-GSD@conv"] },
{ "id": "SUD_French-Spoken@latest", "parallels": ["UD_French-Spoken@conv"] },
{ "id": "SUD_French-Paris-Stories@latest", "parallels": ["UD_French-Paris-Stories@conv"] },
{ "id": "SUD_Naija-NSC@latest", "parallels": ["UD_Naija-NSC@conv"] },
{ "id": "SUD_Naija-NSC_Auto@latest" },
{ "section" : "SUD 2.7 (converted from UD 2.7)" },
......
body {
padding-top: 70px;
padding-bottom: 20px;
margin-left: 0px;
margin-right: 20px;
overflow: hidden;
padding-top: 70px;
padding-bottom: 20px;
margin-left: 0px;
margin-right: 20px;
overflow: hidden;
}
a {
color: black;
color: black;
}
a:hover, a:focus {
color: #000;
color: #000;
}
.panel-title>a {
color: black;
color: black;
}
.panel-title>a:hover {
background: #f0c328;
background: #f0c328;
}
.corpus:hover {
background: #F5D76E;
background: #F5D76E;
}
.selected_corpus:hover {
background: #8bf56e;
background: #8bf56e;
}
.glyphicon {
margin-right: 4px;
margin-left: 4px;
margin-right: 4px;
margin-left: 4px;
}
.table {
margin-bottom: 0px;
margin-bottom: 0px;
}
.panel-body {
padding: 0px;
padding: 0px;
}
#snippets ul, #results-navig ul {
list-style-type: none;
margin: 0;
margin-left: 20px;
padding: 0;
list-style-type: none;
margin: 0;
margin-left: 20px;
padding: 0;
}
#snippets li, #results-navig li {
border-bottom: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
#snippets li:last-child, #results-navig li:last-child {
border: none;
border: none;
}
#snippets li a, #results-navig li a {
text-decoration: none;
color: #000;
display: block;
-webkit-transition: font-size 0.3s ease, background-color 0.3s ease;
-moz-transition: font-size 0.3s ease, background-color 0.3s ease;
-o-transition: font-size 0.3s ease, background-color 0.3s ease;
-ms-transition: font-size 0.3s ease, background-color 0.3s ease;
transition: font-size 0.3s ease, background-color 0.3s ease;
text-decoration: none;
color: #000;
display: block;
-webkit-transition: font-size 0.3s ease, background-color 0.3s ease;
-moz-transition: font-size 0.3s ease, background-color 0.3s ease;
-o-transition: font-size 0.3s ease, background-color 0.3s ease;
-ms-transition: font-size 0.3s ease, background-color 0.3s ease;
transition: font-size 0.3s ease, background-color 0.3s ease;
}
#snippets li a:hover, #results-navig li a:hover {
background: #F5D76E;
background: #F5D76E;
}
h3 {
margin-top: 0px;
margin-top: 0px;
}
.checkbos {
width: 50%;
display: -moz-box;
-moz-box-orient: vertical;
width: 50%;
display: -moz-box;
-moz-box-orient: vertical;
}
.grew-label {
font-size: 24px;
font-size: 24px;
}
#console {
padding-top: 0px;
padding-top: 0px;
}
#results-block, #cluster-block {
display: none;
display: none;
}
.badge-pill {
margin-right: 7px;
margin-right: 7px;
}
#cluster-buttons .btn {
margin: 10px;
margin: 10px;
}
.displayed {
background-color: #8bf56e;
background-color: #8bf56e;
}
/* Style de display-svg */
#result-pic {
height: 100%;
height: 100%;
}
#results-list {
max-height: 400px;
max-height: 400px;
}
#display-svg, #results-list {
overflow: auto;
/*display: none;*/
overflow: auto;
/*display: none;*/
}
#display-svg {
border-style: solid;
border-width: 1px;
border-color: #ccc;
border-style: solid;
border-width: 1px;
border-color: #ccc;
}
#display-parallel {
overflow: auto;
border-style: solid;
border-width: 1px;
border-color: #ccc;
}
.form-group {
margin-bottom: 10px;
margin-top: 10px;
}
#progress-txt {
margin-bottom: 0;
padding-top: 10px;
padding-bottom: 10px;
margin-bottom: 0;
padding-top: 10px;
padding-bottom: 10px;
}
#pattern-input {
width: 95%;
width: 95%;
}
#custom-display {
display: none;
font-size: 15px;
display: none;
font-size: 15px;
}
.item {
cursor: pointer;
cursor: pointer;
}
.CodeMirror {
border-style: solid;
border-width: 1px;
border-color: #ccc;
margin-bottom: 10px;
border-style: solid;
border-width: 1px;
border-color: #ccc;
margin-bottom: 10px;
}
.nav-pills>li.active>a, .nav-pills>li.active>a:focus {
background-color: #C3C6C7;
color: #000;
background-color: #C3C6C7;
color: #000;
}
.nav-pills>li>a:hover, .nav-pills>li.active>a:hover {
background-color: #989B9C;
color: #000;
background-color: #989B9C;
color: #000;
}
.nav-pills>li>a, .nav-pills>li>a:focus {
color: #000;
color: #000;
}
#navbar-grew {
background-image: none;
background-color: #003171;
background-image: none;
background-color: #003171;
}
#right-navbar {
margin-bottom: 0px;
margin-bottom: 0px;
}
#corpus {
margin-top: 10px;
margin-bottom: 10px;
margin-top: 10px;
margin-bottom: 10px;
}
#jumbo-grew {
background-color: #ECF0F1;
margin-top: 15px;
padding-left: 0;
padding-right: 0;
background-color: #ECF0F1;
margin-top: 15px;
padding-left: 0;
padding-right: 0;
}
#jumbo-clust {
background-color: #ECF0F1;
margin-top: 15px;
padding-left: 0;
padding-right: 0;
padding-left: 10px;
padding-right: 10px;
background-color: #ECF0F1;
margin-top: 15px;
padding-left: 0;
padding-right: 0;
padding-left: 10px;
padding-right: 10px;
}
#title-grew {
color: #ECF0F1;
color: #ECF0F1;
}
#grew-main {
width: 100%;
padding-left: 30px;
padding-right: 10px;
overflow-x: hidden;
overflow-y: auto;
width: 100%;
padding-left: 30px;
padding-right: 10px;
overflow-x: hidden;
overflow-y: auto;
}
#right-navbar {
margin-top: 10pt;
margin-top: 10pt;
}
.groups>li {
margin-left: 10pt;
margin-right: 10pt;
margin-left: 10pt;
margin-right: 10pt;
}
.navbar-right>li {
margin-left: 10pt;
margin-right: 10pt;
margin-left: 10pt;
margin-right: 10pt;
}
/* fix cross position in sweet alert */
.x-mark {
top: -38px;
top: -38px;
}
.highlight {
background-color: #8bf56e;
background-color: #8bf56e;
}
.feat {
font-family: monaco, Consolas, Lucida Console, monospace;
color: #bf616a;
font-family: monaco, Consolas, Lucida Console, monospace;
color: #bf616a;
}
#exportResult {
overflow-y: auto;
max-height: 80%;
height: 80%;
overflow-y: auto;
max-height: 80%;
height: 80%;
}
#export-modal {
max-height: 80%;
height: 80%;
max-height: 80%;
height: 80%;
}
#exportResult tr:nth-child(even) {
background-color: #dddddd;
background-color: #dddddd;
}
#exportResult th {
text-align: center;
text-align: center;
}
#exportResult td {
padding: 5px;
padding: 5px;
}
/* vertical bars inside */
#exportResult th + th { border-left:1px solid }
#exportResult td + td { border-left:1px solid }
#exportResult th+th {
border-left: 1px solid
}
#exportResult td+td {
border-left: 1px solid
}
.export-table-4 td:nth-child(2) {
text-align: right;
text-align: right;
}
.export-table-4 td:nth-child(3) {
text-align: center;
text-align: center;
}
.export-table-2 td:nth-child(2) {
text-align: center;
text-align: center;
}
.corpus-folder {
background-color: #CCC;
border-top-style: solid;
border-top-width: thin;
background-color: #CCC;
border-top-style: solid;
border-top-width: thin;
}
.badge-danger {
float: right;
margin-right: 8px;
float: right;
margin-right: 8px;
}
.modal-content {
height: 200%;
height: 200%;
}
#code_viewer {
width: 100%;
height: 100%;
resize: none;
font-family: monospace;
font-size: x-small;
width: 100%;
height: 100%;
resize: none;
font-family: monospace;
font-size: x-small;
}
.swal2-popup {
transform: scale(1.8);
transform: scale(1.8);
}
#sentence-txt {
margin-top: 0pt;
margin-top: 0pt;
}
#whether-input1 + .CodeMirror {
height: 60px;
#whether-input1+.CodeMirror {
height: 60px;
}
#whether-input2 + .CodeMirror {
height: 60px;
#whether-input2+.CodeMirror {
height: 60px;
}
#pattern-input + .CodeMirror {
height: 160px;
#pattern-input+.CodeMirror {
height: 160px;
}
\ No newline at end of file
......@@ -579,6 +579,7 @@ function load_cluster_file() {
audio: obj.audio,
meta: obj.meta,
code: obj.code,
sent_id: obj.sent_id,
}, display_picture);
result_nb++;
update_progress_num();
......@@ -595,6 +596,7 @@ function load_cluster_file() {
// ==================================================================================
function display_picture(event) {
app.sent_id = event.data.sent_id;
$("#sentence-txt").html(event.data.sentence);
if (event.data.audio != undefined) {
......@@ -633,6 +635,7 @@ function display_picture(event) {
$("#svg-link").attr("href", event.data.url);
update_progress_num();
update_parallel();
}
// ==================================================================================
......@@ -713,6 +716,36 @@ function export_tsv() {
});
}
// ==================================================================================
function update_parallel() {
if (app.parallel != "no") {
var data = {
request: "PARALLEL",
id: current_request_id,
corpus: app.parallel,
sent_id: app.sent_id,
};
$.ajax({
url: 'main.php',
dataType: 'text',
data: data,
type: 'post',
success: function(reply) {
var fields = reply.split("@@");
if (fields[1] == 'ERROR') {
report_error(id);
} else {
app.parallel_svg = undefined;
app.parallel_svg = "data/" + fields[1];
}
},
error: function(x) {
alert("[PARALLEL] Ajax error:" + JSON.stringify(x));
}
});
}
}
// ==================================================================================
function download() {
window.location = './data/' + current_request_id + '/export.tsv';
......@@ -942,6 +975,13 @@ function update_corpus() {
$('#eud-box').bootstrapToggle('on');
}
let parallels = get_info(current_corpus, "parallels");
if (parallels) {
app.parallels = parallels;
} else {
app.parallels = [];
}
if (current_corpus.startsWith("SUD") && current_corpus.endsWith("latest")) {
$("#validation").show();
} else {
......@@ -994,7 +1034,7 @@ function select_group(group, corpus) {
function update_group() {
// update labels of checkboxes
if (current_group == "semantics" || current_group == "PMB" ) {
if (current_group == "semantics" || current_group == "PMB") {
app.mode = "semantics";
} else {
app.mode = "syntax";
......
......@@ -13,7 +13,18 @@ var app = new Vue({
code: "",
mode: "",
sent_id: "",
parallel: "no",
parallels: [],
parallel_svg: undefined,
},
methods: {
update_parallel_() {
update_parallel();
}
}
});
$(document).ready(function() {
......
......@@ -15,6 +15,8 @@ if ($request == "NEW") {
shorten();
} elseif ($request == "CONLL") {
conll();
} elseif ($request == "PARALLEL") {
parallel();
}
// ============================================================
......@@ -71,6 +73,12 @@ function conll() {
send($id, $msg);
}
// ============================================================
function parallel() {