This commit is contained in:
cesare 2023-01-10 12:41:24 +01:00
commit 042528001a
1 changed files with 297 additions and 156 deletions

View File

@ -1,17 +1,19 @@
/** /**
* *
*/ */
var resetResult; var resetResult;
$(document).ready(function() { $(document).ready(function() {
const categoriegrammaticali={"v":"Verbo", "s":"Sostantivo", "a":"Aggettivo", "p":"Pronome", "r":"Articolo", "b":"Avverbio","e":"Preposizione", const categoriegrammaticali = {
"c":"Congiunzione", "i":"Interiezione", "n":"Onomastica", "f":"Citazione", "l":"Locuzione", "v": "Verbo", "s": "Sostantivo", "a": "Aggettivo", "p": "Pronome", "r": "Articolo", "b": "Avverbio", "e": "Preposizione",
"r-e":"Articolo, Preposizione", "b-v":"Avverbio, Verbo", "p-v":"Pronome, Verbo", "c": "Congiunzione", "i": "Interiezione", "n": "Onomastica", "f": "Citazione", "l": "Locuzione",
"b-p-v":"Avverbio, Pronome, Verbo", "b-p":"Avverbio, Pronome", "r-e": "Articolo, Preposizione", "b-v": "Avverbio, Verbo", "p-v": "Pronome, Verbo",
"e-p":"Preposizione, Pronome", "a-s":"Aggettivo, Sostantivo", "b-p-v": "Avverbio, Pronome, Verbo", "b-p": "Avverbio, Pronome",
"e-r":"Preposizione, Articolo", "v-b":"Verbo, Avverbio", "v-p":"Verbo, Pronome", "e-p": "Preposizione, Pronome", "a-s": "Aggettivo, Sostantivo",
"v-p-b":"Verbo, Pronome, Avverbio", "p-b":"Pronome, Avverbio", "e-r": "Preposizione, Articolo", "v-b": "Verbo, Avverbio", "v-p": "Verbo, Pronome",
"p-e":"Pronome, Preposizione", "s-a":"Sostantivo, Aggettivo",} "v-p-b": "Verbo, Pronome, Avverbio", "p-b": "Pronome, Avverbio",
"p-e": "Pronome, Preposizione", "s-a": "Sostantivo, Aggettivo",
}
const cantobadgeclass = 'badge badge-outline-info badge-pill' const cantobadgeclass = 'badge badge-outline-info badge-pill'
@ -37,7 +39,12 @@ $(document).ready(function() {
let realScale; let realScale;
let mappedElement = ''; let mappedElement = '';
resetResult=function(){ var purgatorioSelected = "PurgatorioCanto_1";
var paradisoSelected = "ParadisoCanto_1";
var infernoSelected = "InfernoCanto_1";
resetResult = function() {
//console.log('clean result') //console.log('clean result')
cleanSearchResult() cleanSearchResult()
esprlogica = [] esprlogica = []
@ -46,28 +53,71 @@ $(document).ready(function() {
hideMinimap(); hideMinimap();
createAllDivCanti() createAllDivCanti()
const start = performance.now(); const start = performance.now();
showCantica('Inferno') showCantica('Inferno')
showCantica('Purgatorio') var purgatorioLoaded = false;
showCantica('Paradiso') var paradisoLoaded = false;
$("#InfernoCanto_1").attr('style', 'display:block') $("#InfernoCanto_1").attr('style', 'display:block')
drawMinimap("InfernoCanto_1") drawMinimap("InfernoCanto_1")
const end = performance.now(); const end = performance.now();
console.log(`Load cantiche time: ${end - start} ms`); 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() { $("[data-cg]").hover(function() {
var details=getHoverContent($(this).data("cg")) var details = getHoverContent($(this).data("cg"))
var index = details.indexOf(","); var index = details.indexOf(",");
var categoria = ""; var categoria = "";
if (index != -1){ if (index != -1) {
categoria = details.substring(0,index); categoria = details.substring(0, index);
details = details.substring(index+1); details = details.substring(index + 1);
}else{ } else {
categoria = details; categoria = details;
details = ""; details = "";
} }
$(this).popover({title: categoria, content: details, trigger: "click"}); $(this).popover({ title: categoria, content: details, trigger: "click" });
}); });
var mmih = 0 var mmih = 0
@ -101,6 +151,15 @@ $(document).ready(function() {
function manageMiniMap(divElem) { function manageMiniMap(divElem) {
mmiw = $("#" + displayId).innerWidth(); mmiw = $("#" + displayId).innerWidth();
mmih = $("#" + displayId).innerHeight(); 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(" ", "_")) drawMinimap($(divElem).attr('name').replace(" ", "_"))
} }
@ -124,43 +183,52 @@ $(document).ready(function() {
//Utility functions //Utility functions
function getHoverContent(categ){ function getHoverContent(categ) {
//console.log('Categoria '+categ) //console.log('Categoria '+categ)
if(categ.includes('-')){ if (categ.includes('-')) {
categs=categ.split('-') categs = categ.split('-')
mycat=[] mycat = []
for (cat of categs){ for (cat of categs) {
mycat.push(cat[0]) mycat.push(cat[0])
} }
console.log(mycat.join('-')) console.log(mycat.join('-'))
return categoriegrammaticali[mycat.join('-')] return categoriegrammaticali[mycat.join('-')]
} }
if (categ[0]=='v'){ if (categ[0] == 'v') {
return parserVerbi.parse(categ).split(',').filter(prop => prop.length > 0).join() return parserVerbi.parse(categ).split(',').filter(prop => prop.length > 0).join()
} }
if(categ[0]=='s'){ if (categ[0] == 's') {
return parserSostantivi.parse(categ).split(',').filter(prop => prop.length > 0).join() return parserSostantivi.parse(categ).split(',').filter(prop => prop.length > 0).join()
} }
if(categ[0]=='e'){ if (categ[0] == 'e') {
return parserPreposizioni.parse(categ).split(',').filter(prop => prop.length > 0).join() return parserPreposizioni.parse(categ).split(',').filter(prop => prop.length > 0).join()
} }
if(categ[0]=='b'){ if (categ[0] == 'b') {
return parserAvverbi.parse(categ).split(',').filter(prop => prop.length > 0).join() return parserAvverbi.parse(categ).split(',').filter(prop => prop.length > 0).join()
} }
if(categ[0]=='p'){ if (categ[0] == 'p') {
return parserPronomi.parse(categ).split(',').filter(prop => prop.length > 0).join() return parserPronomi.parse(categ).split(',').filter(prop => prop.length > 0).join()
} }
if(categ[0]=='a'){ if (categ[0] == 'a') {
return parserAggettivi.parse(categ).split(',').filter(prop => prop.length > 0).join() return parserAggettivi.parse(categ).split(',').filter(prop => prop.length > 0).join()
} }
if(categ[0]=='r'){ if (categ[0] == 'r') {
return parserArticolo.parse(categ).split(',').filter(prop => prop.length > 0).join() 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]) //console.log(categ[0])
return categoriegrammaticali[categ[0]] return categoriegrammaticali[categ[0]]
} }
function drawMinimap(name){ function drawMinimap(name) {
showMinimap(name) showMinimap(name)
currentMinimap = name; currentMinimap = name;
@ -196,12 +264,12 @@ $(document).ready(function() {
showMinimap(currentMinimap) showMinimap(currentMinimap)
} }
function manageQuery(){ function manageQuery() {
cleanSearchResult() cleanSearchResult()
esprlogica = [] esprlogica = []
jsonQuery=getJsonQuery() jsonQuery = getJsonQuery()
console.log("got json query") console.log("got json query")
if(jsonQuery['QueryAvanzata']==0 && jsonQuery['Clausola0']['queryText']==''){ if (jsonQuery['QueryAvanzata'] == 0 && jsonQuery['Clausola0']['queryText'] == '') {
alert('Digitare una stringa da cercare') alert('Digitare una stringa da cercare')
return return
} }
@ -324,18 +392,18 @@ $(document).ready(function() {
if (cantica == 'Purgatorio') if (cantica == 'Purgatorio')
containerForme = formeseconda containerForme = formeseconda
const endlc = performance.now(); const endlc = performance.now();
console.log(`Load `+cantica+` time: ${endlc - start} ms`); console.log(`Load ` + cantica + ` time: ${endlc - start} ms`);
var elverso, formaItem var elverso, formaItem
for (var cmpItem of containerForme) { for (var cmpItem of containerForme) {
formaItem = cmpItem.split("_") formaItem = cmpItem.split("_")
//createDivVerso(cantica, num, canto, forma, catgram, pos) //createDivVerso(cantica, num, canto, forma, catgram, pos)
if (! setVersi.has(cantica + "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1])){ if (!setVersi.has(cantica + "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1])) {
elverso=createDivVerso(cantica, formaItem[3], 'Canto_' + formaItem[1], formaItem[0], formaItem[4], formaItem[2]) elverso = createDivVerso(cantica, formaItem[3], 'Canto_' + formaItem[1], formaItem[0], formaItem[4], formaItem[2])
setVersi.add(cantica+ "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1]) setVersi.add(cantica + "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1])
} }
else{ else {
//setVersi = createDivVersi(setVersi, cantica, formaItem[3], 'Canto_' + formaItem[1]) //setVersi = createDivVersi(setVersi, cantica, formaItem[3], 'Canto_' + formaItem[1])
createSpanFormeNew(cantica, 'Canto_' + formaItem[1], formaItem[3], formaItem[0], formaItem[4], formaItem[2], elverso) createSpanFormeNew(cantica, 'Canto_' + formaItem[1], formaItem[3], formaItem[0], formaItem[4], formaItem[2], elverso)
} }
@ -373,11 +441,11 @@ $(document).ready(function() {
function createSpanFormeNew(cantica, canto, numverso, forma, catgramm, pos, elementoverso) { function createSpanFormeNew(cantica, canto, numverso, forma, catgramm, pos, elementoverso) {
var spanoccorrenza = $('<span />') var spanoccorrenza = $('<span />')
//var pos = parseInt(pos) //var pos = parseInt(pos)
spanoccorrenza.attr('id', cantica + "_" + canto+ "_" + numverso + "_" + pos) spanoccorrenza.attr('id', cantica + "_" + canto + "_" + numverso + "_" + pos)
spanoccorrenza.attr('data-cg', catgramm) spanoccorrenza.attr('data-cg', catgramm)
//if (listarisultati.length > 0 && listarisultati.includes(spanoccorrenza.attr('id'))) //if (listarisultati.length > 0 && listarisultati.includes(spanoccorrenza.attr('id')))
// spanoccorrenza.attr('class', "font-weight-bold mark ") // spanoccorrenza.attr('class', "font-weight-bold mark ")
spanoccorrenza.append(forma+" ") spanoccorrenza.append(forma + " ")
//elementoverso = $('#' + cantica + "_" + canto + "_" + numverso) //elementoverso = $('#' + cantica + "_" + canto + "_" + numverso)
spanoccorrenza.appendTo(elementoverso) spanoccorrenza.appendTo(elementoverso)
//elementoverso.append('&nbsp;') //elementoverso.append('&nbsp;')
@ -415,17 +483,17 @@ $(document).ready(function() {
var spanoccorrenza = $('<span />') var spanoccorrenza = $('<span />')
//var pos = parseInt(pos) //var pos = parseInt(pos)
spanoccorrenza.attr('id', cantica + "_" + canto+ "_" + num + "_" + pos) spanoccorrenza.attr('id', cantica + "_" + canto + "_" + num + "_" + pos)
spanoccorrenza.attr('data-cg', catgram) spanoccorrenza.attr('data-cg', catgram)
spanoccorrenza.append(forma+" ") spanoccorrenza.append(forma + " ")
spanoccorrenza.appendTo(elementoverso) spanoccorrenza.appendTo(elementoverso)
elementoverso.appendTo('#' + cantica + canto) elementoverso.appendTo('#' + cantica + canto)
return elementoverso return elementoverso
} }
/* /*
function createDivCanti(orderedListaCanti, cantica, canto) { function createDivCanti(orderedListaCanti, cantica, canto) {
if (orderedListaCanti.has(canto)) { if (orderedListaCanti.has(canto)) {
return orderedListaCanti return orderedListaCanti
@ -444,13 +512,13 @@ $(document).ready(function() {
*/ */
function createAllDivCanti() { function createAllDivCanti() {
cantiche=["Inferno", "Purgatorio","Paradiso"] cantiche = ["Inferno", "Purgatorio", "Paradiso"]
for (cantica of cantiche){ for (cantica of cantiche) {
for (var i=1; i<35; i++){ for (var i = 1; i < 35; i++) {
if(i==34 && cantica!=="Inferno"){ if (i == 34 && cantica !== "Inferno") {
continue continue
} }
canto= "Canto "+i canto = "Canto " + i
var divcanto = $('<div />') var divcanto = $('<div />')
var titolocanto = $('<h4 class="titolo-canto pb-2" />') var titolocanto = $('<h4 class="titolo-canto pb-2" />')
titolocanto.append(cantica + ", " + canto) titolocanto.append(cantica + ", " + canto)
@ -486,7 +554,7 @@ $(document).ready(function() {
numverso = binding.get('NumeroVerso').value; numverso = binding.get('NumeroVerso').value;
//posizione del frammento //posizione del frammento
pos = binding.get('pos').value; pos = binding.get('pos').value;
if (!result.has(cantica + "_" + canto.replace(" ", "_") + "_" + numverso + "_" + pos)){ if (!result.has(cantica + "_" + canto.replace(" ", "_") + "_" + numverso + "_" + pos)) {
result.add(cantica + "_" + canto.replace(" ", "_") + "_" + numverso + "_" + pos) result.add(cantica + "_" + canto.replace(" ", "_") + "_" + numverso + "_" + pos)
resultsInCantica.push(cantica); resultsInCantica.push(cantica);
resultsInCanto.push(cantica + canto) resultsInCanto.push(cantica + canto)
@ -509,7 +577,7 @@ $(document).ready(function() {
for (cantica of cantiche) { for (cantica of cantiche) {
i += 1 i += 1
let count = resultsInCantica.reduce((n, x) => n + (x === cantica), 0); let count = resultsInCantica.reduce((n, x) => n + (x === cantica), 0);
if (count>0){ if (count > 0) {
var spanbadgecantica = $('<span />'); var spanbadgecantica = $('<span />');
spanbadgecantica.attr('class', 'badge badge-primary badge-pill ml-1'); spanbadgecantica.attr('class', 'badge badge-primary badge-pill ml-1');
spanbadgecantica.append(count) spanbadgecantica.append(count)
@ -523,7 +591,7 @@ $(document).ready(function() {
if (k == 0) if (k == 0)
continue continue
let count = resultsInCanto.reduce((n, x) => n + (x === cantica + 'Canto ' + k), 0); let count = resultsInCanto.reduce((n, x) => n + (x === cantica + 'Canto ' + k), 0);
if (count>0){ if (count > 0) {
var spanbadge = $('<span />'); var spanbadge = $('<span />');
spanbadge.attr('class', cantobadgeclass); spanbadge.attr('class', cantobadgeclass);
spanbadge.append(count) spanbadge.append(count)
@ -551,22 +619,21 @@ $(document).ready(function() {
}; };
/* /*
* REGOLE DI PARSING PER VISUALIZZAZIONE PROPRIETÀ * REGOLE DI PARSING PER VISUALIZZAZIONE PROPRIETÀ
*/ */
var categoriegrammaticaliGrammar=`Expression = head:(Filtro){return 'Verbo,'+head.join()} 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? coniugazione? modotempo?
persona? funzione? declinazione? persona? funzione* declinazione?
genere? numero? grado?){return tail} genere? numero? grado?){return tail}
diatesi= [a|p] {if (text()=='a') return ' Attivo'; else return ' Passivo';} 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';} 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())){ coniugazione=[1|2|3|4|5]? {switch(parseInt(text())){
case(1): return ' Prima coniugazione'; case(1): return ' Prima coniugazione';
@ -633,9 +700,9 @@ _ "whitespace"= " "*
` `
var categoriaGrammaticaleSostantivo = ` var categoriaGrammaticaleSostantivo = `
Expression = head:(Filtro){return 'Sostantivo,'+head.join()} 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} 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';} 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" Integer "integer"
= _ [0-9]+ { return parseInt(text(), 10); } = _ [0-9]+ { return parseInt(text(), 10); }
@ -659,9 +726,9 @@ _ "whitespace"= " "*
` `
var categoriaGrammaticalePreposizione = ` var categoriaGrammaticalePreposizione = `
Expression = head:(Filtro){return 'Preposizione,'+head.join()} 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';} tipo1=[p|i] {if (text()=='i') return ' Impropria'; else if (text()=='p') return ' Impropria';}
@ -741,17 +808,16 @@ complemento2=
"k14" {return(" Di Rapporto")} "k14" {return(" Di Rapporto")}
` `
var avverbio = ` Expression = head:(Filtro){return 'Avverbio,'+head.join()} 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')}/ tipo="c+" {return(' Avverbio al Comparativo di Maggioranza')}/
"c-" {return(' Avverbio al Comparativo di Minoranza')}/ "c-" {return(' Avverbio al Comparativo di Minoranza')}/
"sa" {return(' Avverbio al Superlativo Assoluto')}/ "sa" {return(' Avverbio al Superlativo Assoluto')}/
"sr" {return(' Avverbio al Superlativo Relativo')}/ "sr" {return(' Avverbio al Superlativo Relativo')}/
"lz" {return(' Avverbio in Locuzione Separato')}/
"l" {return(' Avverbio in Locuzione')}/
"y" {return(' Avverbio Proclitico')}/ "y" {return(' Avverbio Proclitico')}/
"x" {return(' Avverbio Enclitico')}/ "x" {return(' Avverbio Enclitico')}/
"c" {return(' Avverbio al Comparativo di Uguaglianza')} "c" {return(' Avverbio al Comparativo di Uguaglianza')}
@ -762,12 +828,11 @@ Integer "integer"
_ "whitespace"= " "* _ "whitespace"= " "*
` `
var pronome = ` var pronome = `Expression = head:(Filtro){return 'Pronome,'+head.join()}
Filtro= fhead:("p") tail:( tipo_pronome? classe_pronome? genere_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} 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")}/ "i" {return(" Pronome Libero In Composizione")}/
"y" {return(" Pronome Proclitico")}/ "y" {return(" Pronome Proclitico")}/
"x" {return(" Pronome Enclitico")} "x" {return(" Pronome Enclitico")}
funzione_pronome="so" {return(' Libero Soggetto')}/ funzione_pronome= "soi" {return(' Libero Soggetto Impersonale')}/
"soi" {return(' Libero Soggetto Impersonale')}/ "so" {return(' Libero Soggetto')}/
"co" {return(' Libero Complemento')}/ "co" {return(' Libero Complemento')}/
"ra" {return(' Libero Rafforzativo')}/ "ra" {return(' Libero Rafforzativo')}/
"ac" {return(' Clitico Accusativo')}/ "ac" {return(' Clitico Accusativo')}/
@ -816,9 +881,9 @@ Integer "integer"
_ "whitespace"= " "* _ "whitespace"= " "*
` `
var categoriaGrammaticaleAggettivo = ` var categoriaGrammaticaleAggettivo = `
Expression = head:(Filtro){return 'Aggettivo,'+head.join()} 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? numero_aggettivo? grado_aggettivo? tipo_complemento? tipo_frase?
oggetto_indiretto?){return tail} oggetto_indiretto?){return tail}
@ -899,10 +964,10 @@ Integer "integer"
_ "whitespace"= " "* _ "whitespace"= " "*
` `
var categoriaGrammaticaleArticolo = ` var categoriaGrammaticaleArticolo = `
Expression = head:(Filtro){return 'Articolo,'+head.join()} 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 = tipo =
"d" {return(" Determinativo")}/ "d" {return(" Determinativo")}/
@ -924,15 +989,91 @@ _ "whitespace"= " "*
` `
var citazione = `
Expression = head:(Filtro){return 'Citazione,'+head.join()}
Filtro= fhead:("f") tail:( fake? tipo?){return tail}
//parser per categorie fake = ""
var parserVerbi = peg.generate(categoriegrammaticaliGrammar); tipo="l" {return(' Citazione Latina')}/
var parserSostantivi = peg.generate(categoriaGrammaticaleSostantivo); "p" {return(' Citazione Provenzale')}/
var parserPreposizioni = peg.generate(categoriaGrammaticalePreposizione); "r" {return(' Citazione Francese')}/
var parserAvverbi = peg.generate(avverbio); "s" {return(' Citazione Spagnola')}/
var parserPronomi = peg.generate(pronome); "e" {return(' Citazione Ebraica')}/
var parserAggettivi = peg.generate(categoriaGrammaticaleAggettivo); "g" {return(' Citazione Greca')}
var parserArticolo = peg.generate(categoriaGrammaticaleArticolo);
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);
var parserPreposizioni = peg.generate(categoriaGrammaticalePreposizione);
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);
}); });