2022-11-06 17:12:56 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2022-11-08 10:44:20 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var resetResult;
|
|
|
|
var lsid;
|
2023-02-03 15:42:34 +01:00
|
|
|
var lsentid;
|
2023-02-06 12:51:34 +01:00
|
|
|
//var getDimDiv;
|
2023-02-03 15:42:34 +01:00
|
|
|
const formaClass='frm'
|
2023-01-30 15:57:30 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
lsid='';
|
2023-02-01 08:57:41 +01:00
|
|
|
removeGraph=false;
|
2023-02-03 15:42:34 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
const cantobadgeclass = 'badge badge-outline-info badge-pill'
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
const sparqlGenerator = sparqljs.Generator;
|
|
|
|
const myEngine = new Comunica.QueryEngine();
|
|
|
|
const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query";
|
|
|
|
|
|
|
|
var shownSentenceList = new Set()
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-02-06 13:24:43 +01:00
|
|
|
//var currentMinimap = ''
|
2023-01-24 15:40:28 +01:00
|
|
|
var listarisultati = [];
|
2023-01-30 15:57:30 +01:00
|
|
|
var listaPeriodiRisultato = [];
|
2023-01-24 15:40:28 +01:00
|
|
|
var resultSentences = new Set()
|
|
|
|
var minimapScrolling = false;
|
|
|
|
var displayId = 'displaycanto'
|
2023-01-30 15:57:30 +01:00
|
|
|
var cantiche=["Inferno", "Purgatorio","Paradiso"]
|
|
|
|
var loadedCanti=new Set();
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
//used in minimap
|
|
|
|
//
|
2023-02-06 12:51:34 +01:00
|
|
|
/*let minimap = document.createElement('div');
|
2023-01-24 15:40:28 +01:00
|
|
|
let minimapSize = document.createElement('div');
|
|
|
|
let viewer = document.createElement('div');
|
|
|
|
let minimapContent = document.createElement('iframe');
|
|
|
|
let realScale;
|
2023-02-06 12:51:34 +01:00
|
|
|
let mappedElement = '';*/
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
resetResult=function(){
|
|
|
|
//console.log('clean result')
|
|
|
|
cleanSearchResult()
|
|
|
|
esprlogica = []
|
|
|
|
}
|
|
|
|
|
|
|
|
hideMinimap();
|
|
|
|
createAllDivCanti()
|
|
|
|
const start = performance.now();
|
2023-01-30 15:57:30 +01:00
|
|
|
showCanto(formeprima, '1','1')
|
2023-02-01 17:46:32 +01:00
|
|
|
$("#InfernoCanto_1").attr('style', 'display: d-flex;')
|
2023-02-01 08:57:41 +01:00
|
|
|
//$("#InfernoCanto_1").removeClass('hidecanto')
|
|
|
|
|
2023-02-01 17:46:32 +01:00
|
|
|
//$("#InfernoCanto_1").css("display", "block");
|
2023-01-24 15:40:28 +01:00
|
|
|
drawMinimap("InfernoCanto_1")
|
|
|
|
const end = performance.now();
|
|
|
|
console.log(`Load cantiche time: ${end - start} ms`);
|
2023-01-10 15:26:58 +01:00
|
|
|
|
|
|
|
|
2022-12-06 17:39:52 +01:00
|
|
|
|
|
|
|
|
2023-02-03 15:42:34 +01:00
|
|
|
//$(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
|
|
|
|
$(" ."+formaClass).each(function(idx, element) {
|
2023-01-24 15:40:28 +01:00
|
|
|
// We cycle through the elements using each() so that we can choose the element specifically that we wish to clean up afterward
|
|
|
|
var ele = $(element);
|
|
|
|
ele.tooltip({
|
|
|
|
content: (function() {return formatTTContent(ele.attr('title'));}),
|
|
|
|
classes:{"ui-tooltip":'Nik_dropdown-content'},
|
|
|
|
close: function (event, ui) {$(".ui-helper-hidden-accessible").remove();},
|
|
|
|
create: function(ev, ui) {$(this).data("ui-tooltip").liveRegion.remove();},
|
|
|
|
hide: false,
|
|
|
|
show: false
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2023-01-30 15:57:30 +01:00
|
|
|
|
2023-02-03 15:42:34 +01:00
|
|
|
//$( " .Ma, .Co, .Su, .Pa " ).dblclick(function() {
|
|
|
|
$( " ."+formaClass ).dblclick(function() {
|
2023-02-01 08:57:41 +01:00
|
|
|
|
|
|
|
sentenceId=$(this).attr('class').split(' ')[0].replace('$','')
|
2023-02-03 15:42:34 +01:00
|
|
|
console.log('dblclick '+lisid)
|
2023-02-01 08:57:41 +01:00
|
|
|
if (shownSentenceList.has(sentenceId)){
|
|
|
|
resetSentenceStructure(sentenceId)
|
|
|
|
shownSentenceList.delete(sentenceId)
|
|
|
|
lsid=''
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
else{
|
2023-02-03 15:42:34 +01:00
|
|
|
//showSentenceStructure (sentenceId)
|
2023-02-01 08:57:41 +01:00
|
|
|
shownSentenceList.add(sentenceId)
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
2023-01-30 15:57:30 +01:00
|
|
|
|
|
|
|
|
2023-02-03 15:42:34 +01:00
|
|
|
//$(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
|
|
|
|
$(" ."+formaClass).hover(function(idx, element) {
|
2023-01-30 15:57:30 +01:00
|
|
|
|
|
|
|
sentenceId=$(this).attr('class').split(' ')[0].split('_')
|
|
|
|
var tmplisid=sentenceId[0]+'_'+sentenceId[1]+'_'+sentenceId[3]
|
2023-02-03 15:42:34 +01:00
|
|
|
lsentid=$(this).attr('class').split(' ')[0]
|
2023-01-30 15:57:30 +01:00
|
|
|
lisid=tmplisid
|
|
|
|
});
|
|
|
|
|
2022-11-14 09:22:00 +01:00
|
|
|
|
2023-02-01 08:57:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
jQuery(document).delegate('#sentence', 'click', function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
sentenceId=$(this).attr('class').split(' ')[0].replace('$','')
|
|
|
|
console.log(sentenceId)
|
|
|
|
if (shownSentenceList.has(sentenceId)){
|
2023-02-01 08:57:41 +01:00
|
|
|
lisid=''
|
2023-01-24 15:40:28 +01:00
|
|
|
resetSentenceStructure(sentenceId)
|
|
|
|
shownSentenceList.delete(sentenceId)
|
|
|
|
}
|
|
|
|
else{
|
2023-02-03 15:42:34 +01:00
|
|
|
//showSentenceStructure (sentenceId)
|
2023-01-24 15:40:28 +01:00
|
|
|
shownSentenceList.add(sentenceId)
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#" + displayId).scroll(function() {
|
|
|
|
if (minimapScrolling) {
|
|
|
|
minimapScrolling = false
|
|
|
|
console.log('no scroll')
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
console.log('yes scrolling')
|
|
|
|
console.log("viewer top pos before: " + $('#minimapviewer').offset().top)
|
|
|
|
trackScrollCanto()
|
|
|
|
console.log("viewer top pos after: " + $('#minimapviewer').offset().top)
|
|
|
|
}
|
|
|
|
});
|
2022-12-06 10:01:42 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
2022-12-06 10:01:42 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
jQuery(document).delegate('.navig-canto', 'click', function(e) {
|
|
|
|
$('.canto').each(function() {
|
2023-02-01 08:57:41 +01:00
|
|
|
$(this).css("display", "none");
|
2023-01-24 15:40:28 +01:00
|
|
|
});
|
2023-01-30 15:57:30 +01:00
|
|
|
const cid=$(this).attr('name').replace(" ", "_");
|
|
|
|
if ( !(loadedCanti.has(cid)))
|
|
|
|
{
|
|
|
|
|
|
|
|
var parcid=cid.split('_')
|
|
|
|
if(parcid[0].includes('Inferno'))
|
|
|
|
showCanto(formeprima, '1',parcid[1])
|
|
|
|
if(parcid[0].includes('Purgatorio'))
|
|
|
|
showCanto(formeseconda, '2',parcid[1])
|
|
|
|
if(parcid[0].includes('Paradiso'))
|
|
|
|
showCanto(formeterza, '3',parcid[1])
|
|
|
|
loadedCanti.add(cid)
|
|
|
|
}
|
2023-02-01 17:46:32 +01:00
|
|
|
//$("#" + $(this).attr('name').replace(" ", "_")).css("display", "block");
|
|
|
|
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display: d-flex;')
|
2023-01-24 15:40:28 +01:00
|
|
|
manageMiniMap(this);
|
2023-02-03 15:42:34 +01:00
|
|
|
$(" ."+formaClass).each(function(idx, element) {
|
2023-01-30 15:57:30 +01:00
|
|
|
var ele = $(element);
|
|
|
|
ele.tooltip({
|
|
|
|
content: (function() {return formatTTContent(ele.attr('title'));}),
|
|
|
|
classes:{"ui-tooltip":'Nik_dropdown-content'},
|
|
|
|
close: function (event, ui) {$(".ui-helper-hidden-accessible").remove();},
|
|
|
|
create: function(ev, ui) {$(this).data("ui-tooltip").liveRegion.remove();},
|
|
|
|
hide: false,
|
|
|
|
show: false
|
|
|
|
|
|
|
|
});
|
2023-02-01 10:31:28 +01:00
|
|
|
ele.hover(function(idx, element) {
|
|
|
|
|
2023-02-01 17:46:32 +01:00
|
|
|
sentenceId=$(this).attr('class').split(' ')[0].split('_')
|
|
|
|
var tmplisid=sentenceId[0]+'_'+sentenceId[1]+'_'+sentenceId[3]
|
2023-02-03 15:42:34 +01:00
|
|
|
lsentid=$(this).attr('class').split(' ')[0]
|
2023-02-01 17:46:32 +01:00
|
|
|
lisid=tmplisid
|
2023-02-01 10:31:28 +01:00
|
|
|
|
|
|
|
});
|
2023-01-30 15:57:30 +01:00
|
|
|
|
|
|
|
});
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
});
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
function manageMiniMap(divElem) {
|
|
|
|
mmiw = $("#" + displayId).innerWidth();
|
|
|
|
mmih = $("#" + displayId).innerHeight();
|
|
|
|
drawMinimap($(divElem).attr('name').replace(" ", "_"))
|
|
|
|
}
|
|
|
|
|
|
|
|
//Query
|
2022-12-06 11:25:04 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
jQuery(document).delegate('#searchcomm, #searchcomm2', 'click', function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
manageQuery()
|
|
|
|
});
|
|
|
|
|
2022-12-09 10:45:43 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
//Reset
|
2022-12-09 10:45:43 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
|
|
|
console.log('clean')
|
|
|
|
cleanSearchResult()
|
|
|
|
esprlogica = []
|
|
|
|
$('#queryText').val("")
|
2022-12-09 10:45:43 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
//Utility functions
|
|
|
|
|
|
|
|
function formatTTContent(categ){
|
2023-02-02 13:43:55 +01:00
|
|
|
var details=[];
|
|
|
|
|
|
|
|
details = getHoverContent(categ);
|
|
|
|
|
|
|
|
var myitems;
|
2023-02-02 15:00:12 +01:00
|
|
|
var catgramm;
|
2023-02-02 13:43:55 +01:00
|
|
|
var subcatgramm = '';
|
|
|
|
var popoverText = '';
|
|
|
|
|
|
|
|
for (detail of details){
|
|
|
|
myitems= detail.split(',');
|
2023-02-02 15:00:12 +01:00
|
|
|
|
|
|
|
catgramm='<div style="color: #00008B; padding: 5px 5px 0px 5px; "';
|
|
|
|
subcatgramm='<p> <b>'+myitems[0]+'</b><i>'+myitems.slice(1,-1)+'</i></p></div>';
|
|
|
|
popoverText = popoverText + catgramm + subcatgramm;
|
2023-02-02 13:43:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return (popoverText);
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
2023-01-10 10:45:18 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
function getHoverContent(categ){
|
|
|
|
//console.log('Categoria '+categ)
|
2023-02-02 13:43:55 +01:00
|
|
|
var mycat=[];
|
2023-01-24 15:40:28 +01:00
|
|
|
if(categ.includes('^')){
|
2023-02-02 13:43:55 +01:00
|
|
|
categs=categ.split('^')
|
2023-01-24 15:40:28 +01:00
|
|
|
for (cat of categs){
|
2023-02-02 13:43:55 +01:00
|
|
|
mycat.push(proprietaForma(cat))
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
|
|
|
console.log(mycat.join('-'))
|
2023-02-02 13:43:55 +01:00
|
|
|
}else{
|
|
|
|
mycat.push(proprietaForma(categ));
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
2023-02-02 13:43:55 +01:00
|
|
|
return(mycat);
|
|
|
|
}
|
|
|
|
|
|
|
|
function proprietaForma(categ){
|
2023-01-24 15:40:28 +01:00
|
|
|
if (categ[0]=='v'){
|
|
|
|
return parserVerbi.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
if(categ[0]=='s'){
|
|
|
|
return parserSostantivi.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
if(categ[0]=='e'){
|
|
|
|
return parserPreposizioni.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
if(categ[0]=='b'){
|
|
|
|
return parserAvverbi.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
if(categ[0]=='p'){
|
|
|
|
return parserPronomi.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
if(categ[0]=='a'){
|
|
|
|
return parserAggettivi.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
return categoriegrammaticali[categ[0]]
|
|
|
|
}
|
2023-02-06 12:51:34 +01:00
|
|
|
/*
|
2023-01-24 15:40:28 +01:00
|
|
|
function drawMinimap(name){
|
|
|
|
|
|
|
|
showMinimap(name)
|
2023-01-30 15:57:30 +01:00
|
|
|
//$('iframe').contents().find('body').css('backgroundColor', '#eaeae6;');
|
2023-01-24 15:40:28 +01:00
|
|
|
currentMinimap = name;
|
2023-01-10 10:45:18 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
//mmviewer diventa draggable
|
|
|
|
var minimapTopPos = $('#minimapviewer').offset().top
|
|
|
|
console.log("top viewer init " + minimapTopPos)
|
2023-01-10 15:26:58 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
$('#minimapviewer').draggable({
|
|
|
|
axis: "y",
|
|
|
|
containment: $('#displayminimap'),
|
|
|
|
scroll: false,
|
|
|
|
start: function(event, ui) { minimapScrolling = true; },
|
|
|
|
stop: function(event, ui) { minimapScrolling = false; },
|
|
|
|
drag: function(event, ui) {
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
minimapScrolling = true;
|
|
|
|
trackScrollViewer(ui.offset.top - minimapTopPos);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2023-02-06 12:51:34 +01:00
|
|
|
*/
|
2023-01-24 15:40:28 +01:00
|
|
|
function cleanSearchResult() {
|
2023-01-30 15:57:30 +01:00
|
|
|
|
|
|
|
for (msid of listaPeriodiRisultato){
|
|
|
|
$(msid).each(function(){
|
|
|
|
$(this).removeClass("font-weight-bold mark ")
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
for (forma of listarisultati) {
|
|
|
|
idforma = '#' + forma
|
|
|
|
$(idforma).removeClass("font-weight-bold mark ")
|
|
|
|
}
|
2023-01-30 15:57:30 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
$(".badge").remove();
|
|
|
|
listarisultati = []
|
2023-01-30 15:57:30 +01:00
|
|
|
listaPeriodiRisultato=[]
|
2023-01-24 15:40:28 +01:00
|
|
|
resultSentences=new Set()
|
|
|
|
if (currentMinimap != '')
|
|
|
|
showMinimap(currentMinimap)
|
|
|
|
}
|
|
|
|
|
|
|
|
var unitaRicerca='forma'
|
|
|
|
|
|
|
|
function manageQuery(){
|
|
|
|
cleanSearchResult()
|
|
|
|
esprlogica = []
|
|
|
|
jsonQuery=getJsonQuery()
|
|
|
|
|
|
|
|
unitaRicerca=jsonQuery['unitaRicerca']
|
|
|
|
console.log("got json query, unita ricerca: "+unitaRicerca)
|
|
|
|
if(jsonQuery['QueryAvanzata']==0 && jsonQuery['Clausola0']['queryText']==''){
|
|
|
|
alert('Digitare una stringa da cercare')
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
jsonQuery = buildSQ(jsonQuery)
|
|
|
|
|
|
|
|
myquery = new sparqlGenerator().stringify(jsonQuery)
|
|
|
|
console.log(myquery)
|
|
|
|
executeQuerySearch(myquery)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//manage sentence and clauses
|
|
|
|
|
|
|
|
function showSentenceStructure(sentence) {
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
sid = '.' + sentence.toString()
|
|
|
|
//console.log(sid)
|
2023-02-01 17:46:32 +01:00
|
|
|
$(sid).addClass('text-info font-italic')
|
|
|
|
/*
|
2023-01-24 15:40:28 +01:00
|
|
|
$(sid).each(function(){
|
|
|
|
//console.log($(this).attr('class'))
|
|
|
|
if ($(this).attr('class').includes(' Ma ')){
|
|
|
|
$(this).addClass("text-primary font-weight-normal")
|
|
|
|
}
|
|
|
|
if ($(this).attr('class').includes(' Su ')){
|
|
|
|
$(this).addClass("text-info font-weight-normal")
|
|
|
|
}
|
|
|
|
if ($(this).attr('class').includes(' Co ')){
|
|
|
|
$(this).addClass("text-warning font-weight-normal")
|
|
|
|
}
|
|
|
|
if ($(this).attr('class').includes(' Pc ')){
|
|
|
|
$(this).addClass("text-success font-weight-normal")
|
|
|
|
}
|
|
|
|
if ($(this).attr('class').includes(' Pa ')){
|
|
|
|
$(this).addClass("text-secondary font-weight-normal")
|
|
|
|
}
|
|
|
|
})
|
2023-02-01 17:46:32 +01:00
|
|
|
*/
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function resetSentenceStructure(sentence) {
|
2023-02-01 17:46:32 +01:00
|
|
|
/*
|
2023-01-24 15:40:28 +01:00
|
|
|
$(" ." + sentence).removeClass('text-info font-weight-normal')
|
|
|
|
$(" ." + sentence).removeClass('text-primary font-weight-normal')
|
|
|
|
$(" ." + sentence).removeClass('text-secondary font-weight-normal')
|
|
|
|
$(" ." + sentence).removeClass('text-warning font-weight-normal')
|
|
|
|
$(" ." + sentence).removeClass('text-success font-weight-normal')
|
2023-02-01 17:46:32 +01:00
|
|
|
*/
|
|
|
|
$(" ." + sentence).removeClass('text-info font-italic')
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
//minimap management
|
|
|
|
|
2023-02-06 12:51:34 +01:00
|
|
|
/*
|
2023-01-24 15:40:28 +01:00
|
|
|
function showMinimap(element) {
|
|
|
|
mmplace = document.getElementById('displayminimap')
|
|
|
|
minimap.className = 'minimap__container'
|
|
|
|
minimapSize.className = 'minimap__size'
|
|
|
|
viewer.className = 'minimap__viewer'
|
|
|
|
viewer.id = 'minimapviewer'
|
|
|
|
minimapContent.className = 'minimap__content'
|
|
|
|
minimap.append(minimapSize, viewer, minimapContent);
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
mmplace.appendChild(minimap)
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
let html = document.getElementById(element).outerHTML//innerHTML
|
|
|
|
if (html == null | html == '')
|
|
|
|
return;
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
let iFrameDoc = minimapContent.contentWindow.document;
|
2023-01-30 15:57:30 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var cssLinkb = document.createElement("link");
|
|
|
|
cssLinkb.href = "https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css";
|
|
|
|
cssLinkb.rel = "stylesheet";
|
|
|
|
cssLinkb.type = "text/css";
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var cssLinkscroll = document.createElement("link");
|
|
|
|
cssLinkscroll.href = "./css/browsingldc.css";
|
|
|
|
cssLinkscroll.rel = "stylesheet";
|
|
|
|
cssLinkscroll.type = "text/css";
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
iFrameDoc.open();
|
|
|
|
iFrameDoc.write(html);
|
|
|
|
iFrameDoc.close();
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
iFrameDoc.head.appendChild(cssLinkb);
|
|
|
|
iFrameDoc.head.appendChild(cssLinkscroll);
|
2023-02-06 11:53:38 +01:00
|
|
|
$('iframe').contents().find('body').css('backgroundColor', '#f8f9fa;');
|
2023-01-24 15:40:28 +01:00
|
|
|
mappedElement = element
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
getDimensionsDiv()
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-02-01 08:57:41 +01:00
|
|
|
//window.addEventListener('scroll', trackScroll)
|
2023-01-24 15:40:28 +01:00
|
|
|
window.addEventListener('resize', getDimensionsDiv)
|
2023-02-01 08:57:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2022-12-06 11:25:04 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
function getInnerHeight(elm) {
|
|
|
|
var computed = getComputedStyle(elm),
|
|
|
|
padding = parseInt(computed.paddingTop) + parseInt(computed.paddingBottom);
|
2022-11-17 10:15:29 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
return elm.clientHeight - padding
|
|
|
|
}
|
|
|
|
|
|
|
|
function getDimensionsDiv() {
|
|
|
|
var cantoplace = document.getElementById(displayId)
|
|
|
|
var elementplace = document.getElementById(mappedElement)
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var bodyWidth = elementplace.clientWidth;
|
|
|
|
var bodyRatio = elementplace.clientHeight / bodyWidth;
|
|
|
|
|
|
|
|
let winRatio = getInnerHeight(cantoplace) / (cantoplace.clientWidth);
|
2022-12-15 11:12:31 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
//minimap.style.width='15%';
|
|
|
|
minimap.style.width = '100%';
|
2022-12-06 11:25:04 +01:00
|
|
|
|
2023-02-04 16:47:05 +01:00
|
|
|
realScale = minimap.clientWidth / (bodyWidth / 2);
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
minimapSize.style.paddingTop = `${bodyRatio * 100}%`
|
|
|
|
viewer.style.paddingTop = `${winRatio * 100}%`;
|
|
|
|
minimapContent.style.transform = `scale(${realScale})`;
|
|
|
|
minimapContent.style.width = `${(100 / realScale)}%`;
|
|
|
|
minimapContent.style.height = `${(100 / realScale)}%`;
|
|
|
|
//minimapContent.style.height=`100%`;
|
|
|
|
minimapContent.style.float = 'right';
|
|
|
|
}
|
2022-12-05 14:11:02 +01:00
|
|
|
|
2023-01-30 17:59:37 +01:00
|
|
|
getDimDiv = function(){
|
|
|
|
getDimensionsDiv();
|
2023-02-06 12:51:34 +01:00
|
|
|
}*/
|
2023-02-01 08:57:41 +01:00
|
|
|
/*
|
2023-01-24 15:40:28 +01:00
|
|
|
function trackScroll() {
|
2023-02-01 08:57:41 +01:00
|
|
|
console.log('sc '+window.scrollY)
|
2023-01-24 15:40:28 +01:00
|
|
|
viewer.style.transform = `translateY(${window.scrollY * realScale}px)`
|
2023-02-01 08:57:41 +01:00
|
|
|
}*/
|
2023-02-06 12:51:34 +01:00
|
|
|
/*
|
2023-01-24 15:40:28 +01:00
|
|
|
function trackScrollCanto() {
|
|
|
|
console.log('cantoscrollT*realscale ' + document.getElementById(displayId).scrollTop * realScale + ' top: ' + document.getElementById(displayId).scrollTop)
|
|
|
|
viewer.style.transform = `translateY(${document.getElementById(displayId).scrollTop * realScale}px)`
|
|
|
|
}
|
|
|
|
function trackScrollViewer(toppos) {
|
|
|
|
console.log('scrollMMView top*1/realScale: ' + toppos * (1 / realScale) + ' top pos: ' + toppos)
|
|
|
|
did = document.getElementById(displayId)
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
did.scrollTop = (toppos * (1 / realScale))
|
|
|
|
}
|
2023-01-10 10:45:18 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
function hideMinimap() {
|
|
|
|
$('.canto').each(function() {
|
|
|
|
$(this).attr("style", 'display:none');
|
|
|
|
});
|
|
|
|
$(".minimap__container").remove();
|
|
|
|
currentMinimap = ''
|
|
|
|
}
|
2023-02-06 12:51:34 +01:00
|
|
|
*/
|
2023-01-24 15:40:28 +01:00
|
|
|
//Cantica management functions
|
2023-01-30 15:57:30 +01:00
|
|
|
|
|
|
|
function showCanto(formecantica, idcantica, canto) {
|
|
|
|
var setVersiCanto = new Set()
|
|
|
|
var cantica=cantiche[parseInt(idcantica)-1];
|
|
|
|
var elverso, formaItem
|
|
|
|
formecantica.map(function(item) {
|
|
|
|
formaItem = item.split("_");
|
|
|
|
var sentenceid=idcantica+"_"+formaItem[1]+"_s_"+formaItem[5]
|
|
|
|
if (formaItem[1]==canto){
|
|
|
|
if (! setVersiCanto.has(cantica + "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1])){
|
|
|
|
elverso=createDivVersoNew(cantica, formaItem[3], 'Canto_' + formaItem[1])
|
|
|
|
setVersiCanto.add(cantica+ "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1])
|
|
|
|
}
|
|
|
|
createSpanFormeNew(formaItem[0], formaItem[4], formaItem[2], sentenceid,formaItem[6],elverso)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
if (listaPeriodiRisultato.length){
|
|
|
|
for (msid of listaPeriodiRisultato){
|
|
|
|
$(msid).each(function(){
|
|
|
|
$(this).addClass("font-weight-bold mark ")
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (listarisultati.length){
|
|
|
|
//evidenzia risultati
|
|
|
|
for (ris of listarisultati) {
|
|
|
|
idris = '#' + ris
|
|
|
|
$(idris).addClass("font-weight-bold mark ")
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-02-03 15:42:34 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
2023-01-30 15:57:30 +01:00
|
|
|
function createSpanFormeNew(forma, catgramm, pos, sentenceid, clausefunct, elementoverso) {
|
2023-01-24 15:40:28 +01:00
|
|
|
var spanoccorrenza = $('<span />')
|
|
|
|
spanoccorrenza.attr('id', pos)
|
|
|
|
//spanoccorrenza.attr('data-cg', catgramm)
|
|
|
|
spanoccorrenza.attr('title', catgramm)
|
2023-02-03 15:42:34 +01:00
|
|
|
spanoccorrenza.attr('class', sentenceid+" "+clausefunct+' '+formaClass)
|
2023-01-24 15:40:28 +01:00
|
|
|
spanoccorrenza.append(forma+" ")
|
|
|
|
|
|
|
|
spanoccorrenza.appendTo(elementoverso)
|
2022-12-15 11:12:31 +01:00
|
|
|
|
2023-01-30 15:57:30 +01:00
|
|
|
}
|
|
|
|
function createDivVersoNew(cantica, num, canto) {
|
|
|
|
|
|
|
|
var elementoverso = $('<p />')
|
2023-02-01 10:31:28 +01:00
|
|
|
var spannum=$('<span />')
|
|
|
|
spannum.append(num + ". ")
|
|
|
|
spannum.attr('class', 'numverso text-muted')
|
|
|
|
elementoverso.append(spannum)
|
|
|
|
//elementoverso.append(num + ". ")
|
2023-01-30 15:57:30 +01:00
|
|
|
elementoverso.attr("style", "line-height: 0.5em")
|
|
|
|
|
2023-01-30 16:48:25 +01:00
|
|
|
elementoverso.attr('class', 'f6 text-dark text-nowrap font-weight-lighter '+cantica+' '+canto)
|
2023-01-30 15:57:30 +01:00
|
|
|
|
|
|
|
elementoverso.attr('id', cantica + "_" + canto + "_" + num)
|
|
|
|
|
|
|
|
elementoverso.appendTo('#' + cantica + canto)
|
|
|
|
return elementoverso
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
2023-02-03 15:42:34 +01:00
|
|
|
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
function createAllDivCanti() {
|
|
|
|
var cantiche=["Inferno", "Purgatorio","Paradiso"]
|
|
|
|
for (cantica of cantiche){
|
|
|
|
for (var i=1; i<35; i++){
|
|
|
|
if(i==34 && cantica!=="Inferno"){
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
canto= "Canto "+i
|
|
|
|
var divcanto = $('<div />')
|
|
|
|
var titolocanto = $('<h4 class="titolo-canto pb-2" />')
|
|
|
|
titolocanto.append(cantica + ", " + canto)
|
|
|
|
divcanto.attr('class', 'canto')
|
2023-02-01 08:57:41 +01:00
|
|
|
divcanto.css("display", "none")
|
|
|
|
//divcanto.attr('style', 'display:none')
|
2023-01-24 15:40:28 +01:00
|
|
|
divcanto.attr('id', (cantica + canto).replace(" ", "_"))
|
|
|
|
titolocanto.appendTo(divcanto)
|
2023-02-01 18:46:02 +01:00
|
|
|
divcanto.appendTo('#displaycanto')
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
|
|
|
}
|
2023-01-22 17:38:22 +01:00
|
|
|
}
|
2022-12-16 14:05:59 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
//execute query
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
async function executeQuerySearch(query) {
|
|
|
|
seachbBindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
|
|
|
//console.log(query)
|
|
|
|
alert(query)
|
|
|
|
try {
|
|
|
|
var result = new Set()
|
|
|
|
var resultClauses = new Set()
|
|
|
|
|
|
|
|
var resultsInCantica = []
|
|
|
|
var resultsInCanto = []
|
|
|
|
seachbBindingsStream.on('data', (binding) => {
|
|
|
|
//cantica
|
|
|
|
if (binding.has('Cantica'))
|
|
|
|
cantica = binding.get('Cantica').value;
|
|
|
|
else
|
|
|
|
cantica='Nessuna'
|
|
|
|
|
|
|
|
|
|
|
|
//canto
|
|
|
|
if (binding.has('Canto'))
|
|
|
|
canto = binding.get('Canto').value;
|
|
|
|
else
|
|
|
|
canto='Canto 0'
|
|
|
|
|
|
|
|
//numero del verso
|
|
|
|
if (binding.has('NumeroVerso'))
|
|
|
|
numverso = binding.get('NumeroVerso').value;
|
|
|
|
else
|
|
|
|
numverso=0
|
|
|
|
//posizione del frammento
|
|
|
|
if (binding.has('pos'))
|
|
|
|
pos = binding.get('pos').value;
|
|
|
|
else{
|
|
|
|
pos = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//regione della clausola
|
|
|
|
var clfrom=binding.get('clfr').value;
|
|
|
|
var clto=binding.get('clto').value;
|
|
|
|
var cltype=binding.get('clatype').value
|
|
|
|
//id del periodo
|
|
|
|
var sentenceid=binding.get('sentence').value.replace('http://dantenetwork.it/data/commedia/','')
|
|
|
|
|
|
|
|
if (pos>0 && !result.has(pos)){
|
|
|
|
|
|
|
|
result.add(pos)
|
|
|
|
resultsInCantica.push(cantica);
|
|
|
|
resultsInCanto.push(cantica + canto)
|
|
|
|
}
|
|
|
|
resultClauses.add(sentenceid + "-" +clfrom+'-'+clto+"-"+cltype+'-'+cantica+'-'+canto)
|
|
|
|
resultSentences.add(sentenceid)
|
|
|
|
|
|
|
|
});
|
|
|
|
seachbBindingsStream.on('end', () => {
|
|
|
|
var resSent=new Set()
|
|
|
|
console.log('start rendering...')
|
|
|
|
listarisultati = Array.from(result)
|
|
|
|
var listaclausole=Array.from(resultClauses)
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
cantiche = ["Inferno", "Purgatorio", "Paradiso"]
|
|
|
|
|
|
|
|
if (!listarisultati.length || unitaRicerca=='frase'){
|
|
|
|
|
|
|
|
resultsInCantica=[]
|
|
|
|
resultsInCanto=[]
|
2023-01-30 15:57:30 +01:00
|
|
|
listaPeriodiRisultato=[]
|
2023-01-24 15:40:28 +01:00
|
|
|
if (listaclausole.length){
|
|
|
|
for (var frase of listaclausole){
|
|
|
|
var fraseItems=frase.split('-');
|
|
|
|
for (var p=parseInt(fraseItems[1]); p<parseInt(fraseItems[2])+1;p++){
|
2023-01-30 15:57:30 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
listarisultati.push(p)
|
|
|
|
}
|
|
|
|
if (!resSent.has(fraseItems[0]+'-'+fraseItems[3])){
|
|
|
|
resSent.add(fraseItems[0]+'-'+fraseItems[3])
|
|
|
|
resultsInCantica.push(fraseItems[4]);
|
|
|
|
resultsInCanto.push(fraseItems[4] + fraseItems[5])
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (unitaRicerca=='periodo' && listaclausole.length){
|
|
|
|
resultsInCantica=[]
|
|
|
|
resultsInCanto=[]
|
2023-01-30 15:57:30 +01:00
|
|
|
listaPeriodiRisultato=[]
|
2023-01-24 15:40:28 +01:00
|
|
|
for (var frase of listaclausole){
|
|
|
|
var fraseItems=frase.split('-');
|
|
|
|
var mysid = '.' + fraseItems[0].toString()
|
|
|
|
console.log(mysid)
|
2023-01-30 15:57:30 +01:00
|
|
|
//$(mysid).addClass('font-italic')
|
|
|
|
//$(mysid).addClass("font-weight-bold mark ")
|
|
|
|
listaPeriodiRisultato.push(mysid)
|
2023-01-24 15:40:28 +01:00
|
|
|
$(mysid).each(function(){
|
2023-01-30 15:57:30 +01:00
|
|
|
console.log('add id '+$(this).attr('id'));
|
2023-01-24 15:40:28 +01:00
|
|
|
listarisultati.push($(this).attr('id'))
|
|
|
|
});
|
|
|
|
if (!resSent.has(fraseItems[0])){
|
|
|
|
resSent.add(fraseItems[0])
|
|
|
|
resultsInCantica.push(fraseItems[4]);
|
|
|
|
resultsInCanto.push(fraseItems[4] + fraseItems[5])
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (listarisultati.length){
|
|
|
|
//evidenzia risultati
|
|
|
|
for (ris of listarisultati) {
|
|
|
|
idris = '#' + ris
|
|
|
|
$(idris).addClass("font-weight-bold mark ")
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//aggiunge badge con totale risultati accanto alle cantiche
|
|
|
|
i = 0
|
|
|
|
for (cantica of cantiche) {
|
|
|
|
i += 1
|
|
|
|
let count = resultsInCantica.reduce((n, x) => n + (x === cantica), 0);
|
|
|
|
if (count>0){
|
|
|
|
var spanbadgecantica = $('<span />');
|
|
|
|
spanbadgecantica.attr('class', 'badge badge-primary badge-pill ml-1');
|
|
|
|
spanbadgecantica.append(count)
|
|
|
|
spanbadgecantica.appendTo($('#cantica' + i))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//aggiunge badge con totale risultati accanto ai canti
|
|
|
|
console.log('results end...')
|
|
|
|
|
|
|
|
//console.log(sid)
|
|
|
|
var $nctags= $(' .navig-canto')
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
for (cantica of cantiche) {
|
|
|
|
for (k of Array(35).keys()) {
|
|
|
|
if (k == 0)
|
|
|
|
continue
|
|
|
|
let count = resultsInCanto.reduce((n, x) => n + (x === cantica + 'Canto ' + k), 0);
|
|
|
|
if (count>0){
|
|
|
|
var spanbadge = $('<span />');
|
|
|
|
spanbadge.attr('class', cantobadgeclass);
|
|
|
|
spanbadge.append(count)
|
|
|
|
//spanbadge.appendTo($('[name="' + cantica + 'Canto ' + k + '"]'))
|
|
|
|
spanbadge.appendTo($nctags.filter('[name="' + cantica + 'Canto ' + k + '"]'))
|
|
|
|
//spanbadge.insertAfter($('[name="'+cantica+'Canto '+k+'"]'))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log('badge end...')
|
|
|
|
|
|
|
|
//aggiorna minimap
|
|
|
|
if (currentMinimap != '') {
|
|
|
|
showMinimap(currentMinimap)
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
2023-01-22 17:38:22 +01:00
|
|
|
}
|
2023-01-24 15:40:28 +01:00
|
|
|
catch (err) {
|
|
|
|
console.log(err.message);
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* REGOLE DI PARSING PER VISUALIZZAZIONE CATEGORIE GRAMMATICALI
|
|
|
|
*/
|
|
|
|
|
|
|
|
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",}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var categoriegrammaticaliGrammar=`Expression = head:(Filtro){return 'Verbo,'+head.join()}
|
|
|
|
Filtro= fhead:("v")? tail:( transitivita? diatesi? impersonalita?
|
|
|
|
coniugazione? modotempo?
|
|
|
|
persona? funzione? declinazione?
|
|
|
|
genere? numero? grado?){return tail}
|
|
|
|
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
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';}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
impersonalita=([*|+])? {if (text()=='*') return ' Impersonale'; else if (text()=='+')return ' Riflessivo';}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
coniugazione=[1|2|3|4|5]? {switch(parseInt(text())){
|
|
|
|
case(1): return ' Prima coniugazione';
|
|
|
|
case(2): return ' Seconda coniugazione';
|
|
|
|
case(3): return ' Terza coniugazione';
|
|
|
|
case(4): return ' Ausiliare essere'
|
|
|
|
case(5): return ' Ausiliare avere'}}
|
|
|
|
modotempo=modo:"ip" {return(' Presente indicativo')}/
|
|
|
|
"ib" {return(" Passato Prossimo Indicativo")}/
|
|
|
|
"ii" {return(" Imperfetto Indicativo")}/
|
|
|
|
"ir" {return(" Passato Remoto Indicativo")}/
|
|
|
|
"is" {return( " Trapassato Prossimo Indicativo")}/
|
|
|
|
"it" {return( " Trapassato Remoto Indicativo")}/
|
|
|
|
"if" {return(" Futuro Semplice Indicativo")}/
|
|
|
|
"ia" {return(" Futuro Anteriore Indicativo")}/
|
|
|
|
"cp" {return( " Presente Congiuntivo")}/
|
|
|
|
"ci" {return( " Imperfetto Congiuntivo")}/
|
|
|
|
"cr" {return( " Passato Congiuntivo")}/
|
|
|
|
"ct" {return( " Trapassato Congiuntivo")}/
|
|
|
|
"dp" {return( " Presente Condizionale")}/
|
|
|
|
"dr" {return( " Passato Condizionale")}/
|
|
|
|
"mp" {return( " Presente Imperativo")}/
|
|
|
|
"fp" {return( " Presente Infinito")}/
|
|
|
|
"fr" {return( " Passato Infinito")}/
|
|
|
|
"pp" {return( " Presente Participio")}/
|
|
|
|
"pr" {return( " Passato Participio")}/
|
|
|
|
"gp" {return( " Presente Gerundio")}/
|
|
|
|
"gr" {return( " Passato Gerundio")}/
|
|
|
|
"pf" {return( " Participio Futuro")}
|
|
|
|
persona="s1" {return(' Prima persona singolare')}/
|
|
|
|
"s2" {return(' Seconda persona singolare')}/
|
|
|
|
"s3" {return(' Terza persona singolare')}/
|
|
|
|
"p1" {return(' Prima persona plurale')}/
|
|
|
|
"p2" {return(' Seconda persona plurale')}/
|
|
|
|
"p3" {return(' Terza persona plurale')}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
funzione="a" {return(' Verbo Funzione Aggettivo')}/
|
|
|
|
"sm" {return(' Verbo Funzione Sostantivo maschile')}/
|
|
|
|
"sf" {return(' Verbo Funzione Sostantivo femminile')}/
|
|
|
|
"b" {return(' Verbo Funzione Avverbio')}/
|
|
|
|
"l" {return(' Verbo Funzione Locuzione')}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
declinazione=[1|2|3|4|5] {switch(parseInt(text())){
|
|
|
|
case(1): return ' Prima declinazione';
|
|
|
|
case(2): return ' Seconda declinazione';
|
|
|
|
case(3): return ' Terza declinazione';
|
|
|
|
case(4): return ' nd'
|
|
|
|
case(5): return ' nd'}}
|
|
|
|
|
|
|
|
genere=[f|m] {if (text()=='f') return ' Femminile'; else if (text()=='m') return ' Maschile';}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
numero=[s|p] {if (text()=='s') return ' Singolare'; else if (text()=='p') return ' Plurale';}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
grado="c+" {return(' Grado c+ singolare')}/
|
|
|
|
"c-" {return(' Grado c-')}/
|
|
|
|
"c=" {return(' Grado c=')}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-16 14:05:59 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
`
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var categoriaGrammaticaleSostantivo = `
|
|
|
|
Expression = head:(Filtro){return 'Sostantivo,'+head.join()}
|
|
|
|
Filtro= fhead:("s")? tail:( genereforma? declinazionesostantivo? generelemma?
|
|
|
|
numersingolareplurale? locuzione?){return tail}
|
|
|
|
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
declinazionesostantivo= [1|2|3]? {switch(parseInt(text())){
|
|
|
|
case(1): return ' Prima declinazione';
|
|
|
|
case(2): return ' Seconda declinazione';
|
|
|
|
case(3): return ' Terza declinazione'}}
|
|
|
|
|
|
|
|
genereforma=[m|f]? {if (text()=='m') return ' forma maschile'; else if (text()=='f') return ' forma femminile';}
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
generelemma=[m|f]? {if (text()=='m') return ' lemma maschile'; else if (text()=='f') return ' lemma femminile';}
|
|
|
|
|
|
|
|
numersingolareplurale=[s|p]? {if (text()=='s') return ' numero singolare'; else if (text()=='p') return ' numero plurale';}
|
|
|
|
|
|
|
|
locuzione="Iv" {return('In Locuzione verbo');}
|
|
|
|
|
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
|
|
|
|
|
|
|
_ "whitespace"= " "*
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
var categoriaGrammaticalePreposizione = `
|
|
|
|
Expression = head:(Filtro){return 'Preposizione,'+head.join()}
|
|
|
|
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';}
|
|
|
|
tipo2=modo:"a" {return(' Articolata')}/
|
|
|
|
"lx" {return(" In locuzione separata")}/
|
|
|
|
"l" {return(" In locuzione")} /
|
|
|
|
"s" {return(" Semplice")}
|
|
|
|
|
|
|
|
sintassi=[sodbfcnutmezlpa] {if (text()=='s') return ' Soggettiva';
|
|
|
|
if (text()=='o') return ' Oggettiva';
|
|
|
|
if (text()=='d') return ' Dichiarativa';
|
|
|
|
if (text()=='b') return ' Completiva obliqua';
|
|
|
|
if (text()=='f') return ' Finale';
|
|
|
|
if (text()=='c') return ' Causale';
|
|
|
|
if (text()=='n') return ' Concessiva';
|
|
|
|
if (text()=='u') return ' Consecutiva';
|
|
|
|
if (text()=='t') return ' Temporale';
|
|
|
|
if (text()=='m') return ' Modale';
|
|
|
|
if (text()=='e') return ' Eccettuativa';
|
|
|
|
if (text()=='z') return ' Esclusiva';
|
|
|
|
if (text()=='l') return ' Limitativa';
|
|
|
|
if (text()=='p') return ' Comparativa';
|
|
|
|
if (text()=='a') return ' Avversativa';}
|
|
|
|
|
|
|
|
complemento1="ktd" {return(" Di tempo determinato")} /
|
|
|
|
"ktc" {return(" Di tempo continuato")} /
|
|
|
|
"kt" {return(' Di tempo')}/
|
|
|
|
"kdl" {return(" Di moto da luogo")} /
|
|
|
|
"kd" {return(" Di termine")}/
|
|
|
|
"kv" {return(" Di vantaggio")} /
|
|
|
|
"ksl" {return(" Di stato in luogo")} /
|
|
|
|
"ks" {return(" Di svantaggio")} /
|
|
|
|
"kg" {return(" Di specificazione")} /
|
|
|
|
"kml" {return(" Di moto a luogo")} /
|
|
|
|
"km" {return(" Di modo")} /
|
|
|
|
"kw" {return(" Di mezzo")} /
|
|
|
|
"kc" {return(" Di compagnia")} /
|
|
|
|
"ku" {return(" Di unione")} /
|
|
|
|
"ka" {return(" Di allontanamento/separazione")} /
|
|
|
|
"kz" {return(" Di materia")} /
|
|
|
|
"kl" {return(" Di luogo")} /
|
|
|
|
"ko" {return(" Di sostanza")} /
|
|
|
|
"kpl" {return(" Di moto per luogo")} /
|
|
|
|
"kps" {return(" Predicativa del soggetto")} /
|
|
|
|
"kpo" {return(" Predicativa dell'oggetto")}
|
|
|
|
|
|
|
|
|
|
|
|
complemento2=
|
|
|
|
"kp" {return(" Di Limitazione")} /
|
|
|
|
"kq" {return(" Di Qualità")} /
|
|
|
|
"kr" {return(" Di Causa")} /
|
|
|
|
"ki" {return(" Di Agente")} /
|
|
|
|
"ke" {return(" Di Causa Efficiente")} /
|
|
|
|
"kf" {return(" Di Fine Scopo")} /
|
|
|
|
"ky" {return(" Di Paragone")} /
|
|
|
|
"kx" {return(" Di Argomento")} /
|
|
|
|
"kb" {return(" Distributivo")} /
|
|
|
|
"kj" {return(" Di Sostituzione")} /
|
|
|
|
"kn" {return(" Di Estensione")} /
|
|
|
|
"k1b" {return(" Indiretta Benefattiva")} /
|
|
|
|
"k1p" {return(" Indiretta Possessore")} /
|
|
|
|
"k1o" {return(" Indiretta Oggetto")} /
|
|
|
|
"k1d" {return(" Indiretta Dativo")} /
|
|
|
|
"k1e" {return(" Indiretta Esperiente")} /
|
|
|
|
"k2" {return(" Simmetrica")} /
|
|
|
|
"k3" {return(" Di Pena")} /
|
|
|
|
"k4" {return(" Di Effetto")} /
|
|
|
|
"k5" {return(" Concessiv")} /
|
|
|
|
"k6" {return(" Di Origine Provenienza")} /
|
|
|
|
"k7" {return(" Di Abbondanza/Privazione")} /
|
|
|
|
"k8" {return(" Partitiva")} /
|
|
|
|
"k9" {return(" Di Denominazione")} /
|
|
|
|
"k10" {return(" Di Colpa")} /
|
|
|
|
"k11" {return(" Di Quantità")} /
|
|
|
|
"k12" {return(" Di Peso")} /
|
|
|
|
"k13" {return(" Di Esclusione")} /
|
|
|
|
"k14" {return(" Di Rapporto")}
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
`
|
|
|
|
var avverbio = ` Expression = head:(Filtro){return 'Avverbio,'+head.join()}
|
|
|
|
Filtro= fhead:("b")? tail:( fake? tipo?){return tail}
|
|
|
|
|
|
|
|
fake= ""
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
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')}
|
2023-01-10 15:26:58 +01:00
|
|
|
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
`
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var pronome = `
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
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}
|
|
|
|
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo_pronome= "p" {return(' Pronome Personale')}/
|
|
|
|
"f" {return(" Pronome Riflessivo")}/
|
|
|
|
"s" {return(" Pronome Possessivo")}/
|
|
|
|
"d" {return(" Pronome Dimostrativo")}/
|
|
|
|
"i" {return(" Pronome Indefinito")}/
|
|
|
|
"r" {return(" Pronome Relativo")}/
|
|
|
|
"t" {return(" Pronome Interrogativo")}/
|
|
|
|
"e" {return(" Pronome Esclamativo")}/
|
|
|
|
"n" {return(" Pronome Numerale")}
|
|
|
|
|
|
|
|
classe_pronome= "1" {return(" Prima Classe Persona")}/
|
|
|
|
"2" {return(" Seconda Classe Persona")}/
|
|
|
|
"3" {return(" Terza Classe Persona")}
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
genere_pronome= "m" {return(" Maschile")}/
|
|
|
|
"f" {return(" Femminile")}/
|
|
|
|
"n" {return(" Neutro")}
|
|
|
|
numero_pronome= "s" {return(" Singolare")}/
|
|
|
|
"p" {return(" Plurale")}
|
|
|
|
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')}/
|
|
|
|
"co" {return(' Libero Complemento')}/
|
|
|
|
"ra" {return(' Libero Rafforzativo')}/
|
|
|
|
"ac" {return(' Clitico Accusativo')}/
|
|
|
|
"da" {return(' Clitico Dativo')}/
|
|
|
|
"pt" {return(' Clitico Partitivo')}
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2022-12-19 19:19:20 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tiporiflessivi="pr" {return(' Proprio')}/
|
|
|
|
"le" {return(' Lessicalizzato')}/
|
|
|
|
"im" {return(' Impersonale')}/
|
|
|
|
"pa" {return(' Passivo')}/
|
|
|
|
"re" {return(' Reciproco')}
|
2022-12-19 19:19:20 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
`
|
|
|
|
var categoriaGrammaticaleAggettivo = `
|
|
|
|
Expression = head:(Filtro){return 'Aggettivo,'+head.join()}
|
|
|
|
Filtro= fhead:("a")? tail:( tipo_aggettivo classe_aggettivo? genere_aggettivo?
|
|
|
|
numero_aggettivo? grado_aggettivo? tipo_complemento? tipo_frase?
|
|
|
|
oggetto_indiretto?){return tail}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo_aggettivo =
|
|
|
|
"i" {return(" Indefinito")}/
|
|
|
|
"t" {return(" Interrogativo")}/
|
|
|
|
"e" {return(" Esclamativo")}/
|
|
|
|
"n" {return(" Numerale")}/
|
|
|
|
"d" {return(" Dimostrativo")}/
|
|
|
|
"r" {return(" Relativo")}/
|
|
|
|
"s" {return(" Possessivo")}/
|
|
|
|
"l" {return(" In locuzione")}/
|
|
|
|
"" {return(" Qualificativo")}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
classe_aggettivo = "1" {return(" Prima Classe")}/
|
|
|
|
"2" {return(" Seconda Classe")}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
genere_aggettivo= "m" {return(" Maschile")}/
|
|
|
|
"f" {return(" Femminile")}/
|
|
|
|
"n" {return(" Neutro")}
|
|
|
|
|
|
|
|
numero_aggettivo= "s" {return(" Singolare")}/
|
|
|
|
"p" {return(" Plurale")}
|
|
|
|
|
|
|
|
grado_aggettivo = "c+" {return(" Comparativo Di Maggioranza")}/
|
|
|
|
"c-" {return(" Comparativo Di Minoranza")}/
|
|
|
|
"c=" {return(" Comparativo Di Uguaglianza")}/
|
|
|
|
"sr" {return(" Superlativo Relativo")}/
|
|
|
|
"sa" {return(" Superlativo Assoluto")}
|
|
|
|
|
|
|
|
tipo_complemento ="xc10" {return(" Introdotto Da VERSO")}/
|
|
|
|
"xc11" {return(" Introdotto Da SOPRA")}/
|
|
|
|
"xc12" {return(" Introdotto Da SOTTO")}/
|
|
|
|
"xc13" {return(" Introdotto Da DINANZI")}/
|
|
|
|
"xc1" {return(" Introdotto Da A")}/
|
|
|
|
"xc2" {return(" Introdotto Da CON")}/
|
|
|
|
"xc3" {return(" Introdotto Da CONTRO")}/
|
|
|
|
"xc4" {return(" Introdotto Da DA")}/
|
|
|
|
"xc5" {return(" Introdotto Da DI")}/
|
|
|
|
"xc6" {return(" Introdotto Da IN")}/
|
|
|
|
"xc7" {return(" Introdotto Da PER")}/
|
|
|
|
"xc8" {return(" Introdotto Da SU")}/
|
|
|
|
"xc9" {return(" Introdotto Da TRA")}/
|
|
|
|
"xc" {return(" Introdotto Da Preposizione")}/
|
|
|
|
"xo1" {return(" Oggetto Ind")}/
|
|
|
|
"xo5" {return(" Oggetto Ind Compl Con DI")}/
|
|
|
|
"xo" {return(" Oggetto Ind Pronom")}
|
|
|
|
|
2022-12-19 19:19:20 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo_frase =
|
|
|
|
"xf1" {return("Con Infinito Retto Da A")}/
|
|
|
|
"xf2" {return("Con Infinito Retto Da DA")}/
|
|
|
|
"xf3" {return("Con Infinito Retto Da DI")}/
|
|
|
|
"xf4" {return("Con Infinito Retto Da PER")}/
|
|
|
|
"xf5" {return("Con Infinito Retto Da SE")}/
|
|
|
|
"xh1" {return("Con Subordinata All Indicativo")}/
|
|
|
|
"xh2" {return("Con Subordinata Al Congiuntivo")}/
|
|
|
|
"xz1" {return("In Locuzione Imp Infinito")}/
|
|
|
|
"xz2" {return("In LocuzioneImp Che Indicativo")}/
|
|
|
|
"xz3" {return("In Locuzione Imp Che Congiuntivo")}/
|
|
|
|
"xz4" {return("In Locuzione Imp Se Indicativo")}/
|
|
|
|
"xz5" {return("In Locuzione Imp Se Congiuntivo")}/
|
|
|
|
"xz6" {return("In Locuzione Imp Come Indicativo")}/
|
|
|
|
"xz7" {return("In Locuzione Imp Quando Indicativo")}/
|
|
|
|
"xz8" {return("In Locuzione Imp Perché Congiuntivo")}/
|
|
|
|
"xz9" {return("In Locuzione Imp A Infinito")}
|
|
|
|
|
2022-12-19 19:19:20 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
oggetto_indiretto =
|
|
|
|
",o" {return(" Con Oggetto Indiretto")}
|
|
|
|
|
|
|
|
|
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-19 19:35:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
|
|
|
|
|
|
|
`
|
|
|
|
var categoriaGrammaticaleArticolo = `
|
2022-12-19 19:35:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Expression = head:(Filtro){return 'Articolo,'+head.join()}
|
|
|
|
Filtro= fhead:("r")? tail:( tipo? genere? numero?){return tail}
|
2022-12-19 19:35:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo =
|
|
|
|
"d" {return(" Determinativo")}/
|
|
|
|
"i" {return(" Indeterminativo")}
|
2022-12-19 19:35:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
2022-12-19 19:35:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
genere = "m" {return(" Maschile")}/
|
|
|
|
"f" {return(" Femminile")}
|
|
|
|
|
|
|
|
numero = "s" {return(" Singolare")}/
|
|
|
|
"p" {return(" Plurale")}
|
|
|
|
|
|
|
|
|
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-19 19:19:20 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
2022-12-19 19:19:20 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
`
|
|
|
|
var citazione = `
|
|
|
|
Expression = head:(Filtro){return 'Citazione,'+head.join()}
|
|
|
|
Filtro= fhead:("f") tail:( fake? tipo?){return tail}
|
2022-12-22 15:08:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
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')}
|
2022-12-19 19:35:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-22 15:08:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
2022-12-22 15:08:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
`
|
|
|
|
var onomastica = `Expression = head:(Filtro){return 'Onomastica,'+head.join()}
|
|
|
|
Filtro= fhead:("n") tail:( proprio tipo?){return tail}
|
2022-12-22 15:08:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo="x" {return(' Separato')}/
|
|
|
|
"t" {return(' Titolo')}
|
|
|
|
proprio = "p" {return("Nome Proprio")}
|
2022-12-22 15:08:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-22 16:00:13 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
|
|
|
`
|
|
|
|
var congiunzione = `
|
|
|
|
Expression = head:(Filtro){return 'Congiunzione,'+head.join()}
|
|
|
|
Filtro= fhead:("c") tail:( tipo? cordinativasubordinativa? tipocoordinativa?
|
|
|
|
tiposubordinativa* complementodue?){return tail}
|
|
|
|
|
2022-12-22 16:00:13 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo = "lx" {return(' LocuzioneSeparata')}/
|
|
|
|
"c" {return(" Composta")}/
|
|
|
|
"l" {return(" Locuzione")}/
|
|
|
|
"s" {return(" Semplice")}
|
|
|
|
|
|
|
|
cordinativasubordinativa = "c" {return(" Coordinativa")}/
|
|
|
|
"s" {return(" Subordinativa")}
|
2022-12-22 16:00:13 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
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")}
|
2022-12-22 16:00:13 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-22 15:08:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
|
|
|
`
|
|
|
|
//parser per categorie grammaticali
|
|
|
|
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);
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2022-12-16 14:05:59 +01:00
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
});
|