Merge branch 'master' of https://gitea-s2i2s.isti.cnr.it/concordia/LiDa_Search.git
This commit is contained in:
commit
042528001a
|
@ -4,14 +4,16 @@
|
|||
var resetResult;
|
||||
|
||||
$(document).ready(function() {
|
||||
const categoriegrammaticali={"v":"Verbo", "s":"Sostantivo", "a":"Aggettivo", "p":"Pronome", "r":"Articolo", "b":"Avverbio","e":"Preposizione",
|
||||
const categoriegrammaticali = {
|
||||
"v": "Verbo", "s": "Sostantivo", "a": "Aggettivo", "p": "Pronome", "r": "Articolo", "b": "Avverbio", "e": "Preposizione",
|
||||
"c": "Congiunzione", "i": "Interiezione", "n": "Onomastica", "f": "Citazione", "l": "Locuzione",
|
||||
"r-e": "Articolo, Preposizione", "b-v": "Avverbio, Verbo", "p-v": "Pronome, Verbo",
|
||||
"b-p-v": "Avverbio, Pronome, Verbo", "b-p": "Avverbio, Pronome",
|
||||
"e-p": "Preposizione, Pronome", "a-s": "Aggettivo, Sostantivo",
|
||||
"e-r": "Preposizione, Articolo", "v-b": "Verbo, Avverbio", "v-p": "Verbo, Pronome",
|
||||
"v-p-b": "Verbo, Pronome, Avverbio", "p-b": "Pronome, Avverbio",
|
||||
"p-e":"Pronome, Preposizione", "s-a":"Sostantivo, Aggettivo",}
|
||||
"p-e": "Pronome, Preposizione", "s-a": "Sostantivo, Aggettivo",
|
||||
}
|
||||
|
||||
const cantobadgeclass = 'badge badge-outline-info badge-pill'
|
||||
|
||||
|
@ -37,6 +39,11 @@ $(document).ready(function() {
|
|||
let realScale;
|
||||
let mappedElement = '';
|
||||
|
||||
var purgatorioSelected = "PurgatorioCanto_1";
|
||||
var paradisoSelected = "ParadisoCanto_1";
|
||||
var infernoSelected = "InfernoCanto_1";
|
||||
|
||||
|
||||
resetResult = function() {
|
||||
//console.log('clean result')
|
||||
cleanSearchResult()
|
||||
|
@ -46,16 +53,59 @@ $(document).ready(function() {
|
|||
hideMinimap();
|
||||
createAllDivCanti()
|
||||
const start = performance.now();
|
||||
|
||||
showCantica('Inferno')
|
||||
showCantica('Purgatorio')
|
||||
showCantica('Paradiso')
|
||||
var purgatorioLoaded = false;
|
||||
var paradisoLoaded = false;
|
||||
|
||||
$("#InfernoCanto_1").attr('style', 'display:block')
|
||||
drawMinimap("InfernoCanto_1")
|
||||
const end = performance.now();
|
||||
console.log(`Load cantiche time: ${end - start} ms`);
|
||||
|
||||
jQuery(document).delegate('#cantica2', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (!purgatorioLoaded){
|
||||
showCantica('Purgatorio')
|
||||
purgatorioLoaded = true;
|
||||
}
|
||||
|
||||
$('.canto').each(function() {
|
||||
$(this).attr("style", 'display:none');
|
||||
});
|
||||
$("#"+purgatorioSelected).attr('style', 'display:block')
|
||||
manageMiniMap("#"+purgatorioSelected);
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
jQuery(document).delegate('#cantica3', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (!paradisoLoaded){
|
||||
showCantica('Paradiso')
|
||||
paradisoLoaded = true;
|
||||
}
|
||||
|
||||
$('.canto').each(function() {
|
||||
$(this).attr("style", 'display:none');
|
||||
});
|
||||
$("#"+paradisoSelected).attr('style', 'display:block')
|
||||
manageMiniMap("#"+paradisoSelected);
|
||||
|
||||
return true;
|
||||
});
|
||||
jQuery(document).delegate('#cantica1', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$('.canto').each(function() {
|
||||
$(this).attr("style", 'display:none');
|
||||
});
|
||||
$("#"+infernoSelected).attr('style', 'display:block')
|
||||
manageMiniMap("#"+infernoSelected);
|
||||
return true;
|
||||
});
|
||||
$("[data-cg]").hover(function() {
|
||||
var details = getHoverContent($(this).data("cg"))
|
||||
var index = details.indexOf(",");
|
||||
|
@ -101,6 +151,15 @@ $(document).ready(function() {
|
|||
function manageMiniMap(divElem) {
|
||||
mmiw = $("#" + displayId).innerWidth();
|
||||
mmih = $("#" + displayId).innerHeight();
|
||||
var selectedCanto = ($(divElem).attr('name').replace(" ", "_"));
|
||||
if (selectedCanto.startsWith("Inferno")){
|
||||
infernoSelected = selectedCanto;
|
||||
}else
|
||||
if(selectedCanto.startsWith("Paradiso")){
|
||||
paradisoSelected = selectedCanto;
|
||||
}else{
|
||||
purgatorioSelected = selectedCanto;
|
||||
}
|
||||
drawMinimap($(divElem).attr('name').replace(" ", "_"))
|
||||
}
|
||||
|
||||
|
@ -156,6 +215,15 @@ $(document).ready(function() {
|
|||
if (categ[0] == 'r') {
|
||||
return parserArticolo.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
||||
}
|
||||
if (categ[0] == 'f') {
|
||||
return parserCitazione.parse(categ).split(',').filter(prop => prop.length > 0).join();
|
||||
}
|
||||
if (categ[0] == 'n') {
|
||||
return parserOnomastica.parse(categ).split(',').filter(prop => prop.length > 0).join();
|
||||
}
|
||||
if (categ[0] == 'c') {
|
||||
return parserCongiunzione.parse(categ).split(',').filter(prop => prop.length > 0).join();
|
||||
}
|
||||
//console.log(categ[0])
|
||||
return categoriegrammaticali[categ[0]]
|
||||
}
|
||||
|
@ -556,17 +624,16 @@ $(document).ready(function() {
|
|||
*/
|
||||
|
||||
var categoriegrammaticaliGrammar = `Expression = head:(Filtro){return 'Verbo,'+head.join()}
|
||||
Filtro= fhead:("v")? tail:( transitivita? diatesi? impersonalita?
|
||||
Filtro= fhead:("v") tail:( transitivita? diatesi? impersonalita*
|
||||
coniugazione? modotempo?
|
||||
persona? funzione? declinazione?
|
||||
persona? funzione* declinazione?
|
||||
genere? numero? grado?){return tail}
|
||||
|
||||
|
||||
diatesi= [a|p] {if (text()=='a') return ' Attivo'; else return ' Passivo';}
|
||||
|
||||
transitivita=[i|t]? {if (text()=='t') return ' Transitivo'; else if (text()=='i') return ' Intransitivo';}
|
||||
|
||||
impersonalita=([*|+])? {if (text()=='*') return ' Impersonale'; else if (text()=='+')return ' Riflessivo';}
|
||||
impersonalita=([*|+]) {if (text()=='*') return ' Impersonale'; else if (text()=='+')return ' Riflessivo';}
|
||||
|
||||
coniugazione=[1|2|3|4|5]? {switch(parseInt(text())){
|
||||
case(1): return ' Prima coniugazione';
|
||||
|
@ -635,7 +702,7 @@ _ "whitespace"= " "*
|
|||
|
||||
var categoriaGrammaticaleSostantivo = `
|
||||
Expression = head:(Filtro){return 'Sostantivo,'+head.join()}
|
||||
Filtro= fhead:("s")? tail:( genereforma? declinazionesostantivo? generelemma?
|
||||
Filtro= fhead:("s") tail:( genereforma? declinazionesostantivo? generelemma?
|
||||
numersingolareplurale? locuzione?){return tail}
|
||||
|
||||
|
||||
|
@ -650,7 +717,7 @@ generelemma=[m|f]? {if (text()=='m') return ' lemma maschile'; else if (text()==
|
|||
|
||||
numersingolareplurale=[s|p]? {if (text()=='s') return ' numero singolare'; else if (text()=='p') return ' numero plurale';}
|
||||
|
||||
locuzione="Iv" {return('In Locuzione verbo');}
|
||||
locuzione="lv" {return('In Locuzione verbo');}
|
||||
|
||||
Integer "integer"
|
||||
= _ [0-9]+ { return parseInt(text(), 10); }
|
||||
|
@ -661,7 +728,7 @@ _ "whitespace"= " "*
|
|||
|
||||
var categoriaGrammaticalePreposizione = `
|
||||
Expression = head:(Filtro){return 'Preposizione,'+head.join()}
|
||||
Filtro= fhead:("e")? tail:( tipo1? tipo2? sintassi? complemento1? complemento2?){return tail}
|
||||
Filtro= fhead:("e") tail:( tipo1? tipo2? sintassi? complemento1? complemento2?){return tail}
|
||||
|
||||
|
||||
tipo1=[p|i] {if (text()=='i') return ' Impropria'; else if (text()=='p') return ' Impropria';}
|
||||
|
@ -742,16 +809,15 @@ complemento2=
|
|||
|
||||
`
|
||||
var avverbio = `Expression = head:(Filtro){return 'Avverbio,'+head.join()}
|
||||
Filtro= fhead:("b")? tail:( fake? tipo?){return tail}
|
||||
Filtro= fhead:("b") tail:( locuzione? tipo?){return tail}
|
||||
|
||||
fake= ""
|
||||
locuzione = "lz" {return(' Avverbio in Locuzione Separato')}/
|
||||
"l" {return(' Avverbio in Locuzione')}
|
||||
|
||||
tipo="c+" {return(' Avverbio al Comparativo di Maggioranza')}/
|
||||
"c-" {return(' Avverbio al Comparativo di Minoranza')}/
|
||||
"sa" {return(' Avverbio al Superlativo Assoluto')}/
|
||||
"sr" {return(' Avverbio al Superlativo Relativo')}/
|
||||
"lz" {return(' Avverbio in Locuzione Separato')}/
|
||||
"l" {return(' Avverbio in Locuzione')}/
|
||||
"y" {return(' Avverbio Proclitico')}/
|
||||
"x" {return(' Avverbio Enclitico')}/
|
||||
"c" {return(' Avverbio al Comparativo di Uguaglianza')}
|
||||
|
@ -762,12 +828,11 @@ Integer "integer"
|
|||
|
||||
_ "whitespace"= " "*
|
||||
|
||||
|
||||
`
|
||||
|
||||
var pronome = `
|
||||
|
||||
Expression = head:(Filtro){return 'Pronome,'+head.join()}
|
||||
Filtro= fhead:("p")? tail:( tipo_pronome? classe_pronome? genere_pronome?
|
||||
var pronome = `Expression = head:(Filtro){return 'Pronome,'+head.join()}
|
||||
Filtro= fhead:("p") tail:( tipo_pronome? classe_pronome? genere_pronome?
|
||||
numero_pronome? forma_pronome? funzione_pronome? tiporiflessivi?){return tail}
|
||||
|
||||
|
||||
|
@ -794,8 +859,8 @@ forma_pronome= "l" {return(" Pronome Libero")}/
|
|||
"i" {return(" Pronome Libero In Composizione")}/
|
||||
"y" {return(" Pronome Proclitico")}/
|
||||
"x" {return(" Pronome Enclitico")}
|
||||
funzione_pronome="so" {return(' Libero Soggetto')}/
|
||||
"soi" {return(' Libero Soggetto Impersonale')}/
|
||||
funzione_pronome= "soi" {return(' Libero Soggetto Impersonale')}/
|
||||
"so" {return(' Libero Soggetto')}/
|
||||
"co" {return(' Libero Complemento')}/
|
||||
"ra" {return(' Libero Rafforzativo')}/
|
||||
"ac" {return(' Clitico Accusativo')}/
|
||||
|
@ -818,7 +883,7 @@ _ "whitespace"= " "*
|
|||
`
|
||||
var categoriaGrammaticaleAggettivo = `
|
||||
Expression = head:(Filtro){return 'Aggettivo,'+head.join()}
|
||||
Filtro= fhead:("a")? tail:( tipo_aggettivo classe_aggettivo? genere_aggettivo?
|
||||
Filtro= fhead:("a") tail:( tipo_aggettivo classe_aggettivo? genere_aggettivo?
|
||||
numero_aggettivo? grado_aggettivo? tipo_complemento? tipo_frase?
|
||||
oggetto_indiretto?){return tail}
|
||||
|
||||
|
@ -902,7 +967,7 @@ _ "whitespace"= " "*
|
|||
var categoriaGrammaticaleArticolo = `
|
||||
|
||||
Expression = head:(Filtro){return 'Articolo,'+head.join()}
|
||||
Filtro= fhead:("r")? tail:( tipo? genere? numero?){return tail}
|
||||
Filtro= fhead:("r") tail:( tipo? genere? numero?){return tail}
|
||||
|
||||
tipo =
|
||||
"d" {return(" Determinativo")}/
|
||||
|
@ -924,7 +989,80 @@ _ "whitespace"= " "*
|
|||
|
||||
|
||||
`
|
||||
var citazione = `
|
||||
Expression = head:(Filtro){return 'Citazione,'+head.join()}
|
||||
Filtro= fhead:("f") tail:( fake? tipo?){return tail}
|
||||
|
||||
fake = ""
|
||||
tipo="l" {return(' Citazione Latina')}/
|
||||
"p" {return(' Citazione Provenzale')}/
|
||||
"r" {return(' Citazione Francese')}/
|
||||
"s" {return(' Citazione Spagnola')}/
|
||||
"e" {return(' Citazione Ebraica')}/
|
||||
"g" {return(' Citazione Greca')}
|
||||
|
||||
Integer "integer"
|
||||
= _ [0-9]+ { return parseInt(text(), 10); }
|
||||
|
||||
_ "whitespace"= " "*
|
||||
|
||||
`
|
||||
var onomastica = `Expression = head:(Filtro){return 'Onomastica,'+head.join()}
|
||||
Filtro= fhead:("n") tail:( proprio tipo?){return tail}
|
||||
|
||||
tipo="x" {return(' Separato')}/
|
||||
"t" {return(' Titolo')}
|
||||
proprio = "p" {return("Nome Proprio")}
|
||||
|
||||
Integer "integer"
|
||||
= _ [0-9]+ { return parseInt(text(), 10); }
|
||||
|
||||
_ "whitespace"= " "*
|
||||
`
|
||||
var congiunzione = `
|
||||
Expression = head:(Filtro){return 'Congiunzione,'+head.join()}
|
||||
Filtro= fhead:("c") tail:( tipo? cordinativasubordinativa? tipocoordinativa?
|
||||
tiposubordinativa* complementodue?){return tail}
|
||||
|
||||
|
||||
tipo = "lx" {return(' Semplice')}/
|
||||
"c" {return(" Composta")}/
|
||||
"l" {return(" Locuzione")}/
|
||||
"s" {return(" LocuzioneSeparata")}
|
||||
|
||||
cordinativasubordinativa = "c" {return(" Coordinativa")}/
|
||||
"s" {return(" Subordinativa")}
|
||||
|
||||
tipocoordinativa = "c" {return(" Copulativa")}/
|
||||
"d" {return(" Disgiuntiva")}/
|
||||
"a" {return(" Avversativa")}/
|
||||
"n" {return(" Conclusiva")}/
|
||||
"e" {return(" Esplicativa")}/
|
||||
"r" {return(" Correlativa")}
|
||||
tiposubordinativa = "s" {return(" Soggettiva")}/
|
||||
"o" {return(" Oggettiva")}/
|
||||
"d" {return(" Dichiarativa")}/
|
||||
"b" {return(" Completiva Obliqua")}/
|
||||
"i" {return(" Interrogativa")}/
|
||||
"f" {return(" Finali")}/
|
||||
"c" {return(" Causali")}/
|
||||
"n" {return(" Concessiva")}/
|
||||
"u" {return(" Consecutiva")}/
|
||||
"t" {return(" Temporale")}/
|
||||
"m" {return(" Modale")}/
|
||||
"e" {return(" Eccettuativa")}/
|
||||
"p" {return(" Comparativa")}/
|
||||
"v" {return(" Condizionale")}/
|
||||
"z" {return(" Esclusiva")}/
|
||||
"l" {return(" Limitativa")}
|
||||
complementodue =
|
||||
"x" {return(" Locuzione Separata")}
|
||||
|
||||
Integer "integer"
|
||||
= _ [0-9]+ { return parseInt(text(), 10); }
|
||||
|
||||
_ "whitespace"= " "*
|
||||
`
|
||||
//parser per categorie
|
||||
var parserVerbi = peg.generate(categoriegrammaticaliGrammar);
|
||||
var parserSostantivi = peg.generate(categoriaGrammaticaleSostantivo);
|
||||
|
@ -933,6 +1071,9 @@ var parserAvverbi = peg.generate(avverbio);
|
|||
var parserPronomi = peg.generate(pronome);
|
||||
var parserAggettivi = peg.generate(categoriaGrammaticaleAggettivo);
|
||||
var parserArticolo = peg.generate(categoriaGrammaticaleArticolo);
|
||||
var parserCitazione = peg.generate(citazione);
|
||||
var parserOnomastica = peg.generate(onomastica);
|
||||
var parserCongiunzione = peg.generate(congiunzione);
|
||||
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue