From 0d7913d57a1cdef8dcf6fd63ce4855d250c32448 Mon Sep 17 00:00:00 2001 From: Luca Foppiano Date: Thu, 18 Jan 2024 17:58:32 +0900 Subject: [PATCH] visualise paragraphs or sentences mutually exclusively if the segmentation is enabled --- .../src/main/resources/web/grobid/grobid.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/grobid-service/src/main/resources/web/grobid/grobid.js b/grobid-service/src/main/resources/web/grobid/grobid.js index 5f7a7c1f0b..1baa0bc1a6 100644 --- a/grobid-service/src/main/resources/web/grobid/grobid.js +++ b/grobid-service/src/main/resources/web/grobid/grobid.js @@ -13,7 +13,7 @@ var grobid = (function($) { var block = 0; - var elementCoords = ['s', 'biblStruct', 'persName', 'figure', 'formula', 'head', 'note', 'title', 'affiliation']; + var elementCoords = ['p', 's', 'biblStruct', 'persName', 'figure', 'formula', 'head', 'note', 'title', 'affiliation']; function defineBaseURL(ext) { var baseUrl = null; @@ -239,10 +239,15 @@ var grobid = (function($) { function ShowRequest1(formData, jqForm, options) { var addCoordinates = false; + var segmentSentences = false; for(var formd in formData) { if (formData[formd].name == 'teiCoordinates') { addCoordinates = true; } + if (formData[formd].name == 'segmentSentences') { + segmentSentences = true; + } + } if (addCoordinates) { for (var i in elementCoords) { @@ -252,6 +257,15 @@ var grobid = (function($) { "type": "checkbox", "required": false } + if (segmentSentences === false) { + if (elementCoords[i] === "s") { + continue; + } + } else { + if (elementCoords[i] === "p") { + continue; + } + } additionalFormData["value"] = elementCoords[i] formData.push(additionalFormData) }