Commit fe2ad659 authored by Sylvain Coulange's avatar Sylvain Coulange

mise à jour souligné pour ADP_DET + styles codés en dur pour copier-coller

parent 09a269ba
......@@ -29,20 +29,44 @@ async function runSpacy() {
body: JSON.stringify(colis)
};
// ENVOI
// REQUÊTAGE SERVEUR
const response = await fetch('/runSpacy/', options)
console.log('En attente de réponse...');
const data = await response.json();
console.log(data);
// AFFICHAGE DU RÉSULTAT
var result = "";
var stylesCommuns = "font-family: Palatino, Times, Calibri; font-size: 35pt; font-weight: bold; background-color: black;";
var stylesUnderline = "text-decoration: underline; text-decoration-thickness: 6px;";
for (i=0; i<data.outText.length; i++) {
if (pos[data.outText[i].pos].color == '') col = "#ccc";
else col = pos[data.outText[i].pos].color;
// saut de ligne
if (data.outText[i].text == "\n") result = result + "<br>";
else if (data.outText[i].text == " ") result = result + "<span> </span>";
else result = result + '<span style="color:'+ col +'" title="'+ data.outText[i].tag +'">'+ data.outText[i].text + '</span>';
// espace
else if (data.outText[i].text == " ") result = result + "<span style='"+ stylesCommuns +"'> </span>";
// bicolores → soulignage
else if (data.outText[i].pos == "DET" && data.outText[i].tag.slice(0,7)== "ADP_DET") {
result = result
+ '<span style="color:'+ col +';'
+ stylesCommuns
+ stylesUnderline + 'text-decoration-color:' + pos["ADP"].color
+'" title="'+ data.outText[i].tag
+'">'+ data.outText[i].text + '</span>';
}
// tout le reste
else result = result
+ '<span style="color:'+ col +';'
+ stylesCommuns
+'" title="'+ data.outText[i].tag
+'">'+ data.outText[i].text + '</span>';
}
var outText = document.getElementById('outText');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment