From e769a52f942a39abfdf74c1803a6fa765f0833ad Mon Sep 17 00:00:00 2001 From: Luca Foppiano Date: Wed, 20 Dec 2023 13:40:59 +0900 Subject: [PATCH 1/4] correct coordinates attribute name --- .../src/main/java/org/grobid/core/document/TEIFormatter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grobid-core/src/main/java/org/grobid/core/document/TEIFormatter.java b/grobid-core/src/main/java/org/grobid/core/document/TEIFormatter.java index 82b450a997..28d9195e90 100755 --- a/grobid-core/src/main/java/org/grobid/core/document/TEIFormatter.java +++ b/grobid-core/src/main/java/org/grobid/core/document/TEIFormatter.java @@ -154,7 +154,7 @@ public StringBuilder toTEIHeader(BiblioItem biblio, if (titleTokens != null && titleTokens.size()>0) { String coords = LayoutTokensUtil.getCoordsString(titleTokens); if (coords != null) { - tei.append(" coord=\"" + coords + "\""); + tei.append(" coords=\"" + coords + "\""); } } } @@ -394,7 +394,7 @@ else if (biblio.getE_Year().length() == 4) if (titleTokens != null && titleTokens.size()>0) { String coords = LayoutTokensUtil.getCoordsString(titleTokens); if (coords != null) { - tei.append(" coord=\"" + coords + "\""); + tei.append(" coords=\"" + coords + "\""); } } } From 442d21999b967a1fd1d46d1915472a9e0990c5ff Mon Sep 17 00:00:00 2001 From: Luca Foppiano <Foppiano.Luca@nims.go.jp> Date: Wed, 20 Dec 2023 14:09:17 +0900 Subject: [PATCH 2/4] add title in the list of coordinates --- grobid-service/src/main/resources/web/grobid/grobid.js | 2 +- 1 file changed, 1 insertion(+), 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 f84cbee883..aaf89ca926 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']; + var elementCoords = ['p', 's', 'biblStruct', 'persName', 'figure', 'formula', 'head', 'note', 'title']; function defineBaseURL(ext) { var baseUrl = null; From 44230794a66804a0f8c5ed723a6fb8d31b0b6aac Mon Sep 17 00:00:00 2001 From: Luca Foppiano <Foppiano.Luca@nims.go.jp> Date: Wed, 20 Dec 2023 14:12:54 +0900 Subject: [PATCH 3/4] add missing coordinates elements in batch mode --- .../src/main/java/org/grobid/core/engines/ProcessEngine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grobid-core/src/main/java/org/grobid/core/engines/ProcessEngine.java b/grobid-core/src/main/java/org/grobid/core/engines/ProcessEngine.java index 60c5a15830..2f211dee6c 100644 --- a/grobid-core/src/main/java/org/grobid/core/engines/ProcessEngine.java +++ b/grobid-core/src/main/java/org/grobid/core/engines/ProcessEngine.java @@ -137,7 +137,7 @@ public void processFullText(final GrobidMainArgs pGbdArgs) throws Exception { } else { List<String> elementCoordinates = null; if (pGbdArgs.getTeiCoordinates()) { - elementCoordinates = Arrays.asList("figure", "persName", "ref", "biblStruct", "formula", "s", "note"); + elementCoordinates = Arrays.asList("figure", "persName", "ref", "biblStruct", "formula", "s", "note", "title", "head"); } processFullTextDirectory(files, pGbdArgs, pGbdArgs.getPath2Output(), pGbdArgs.getSaveAssets(), elementCoordinates, pGbdArgs.getSegmentSentences(), pGbdArgs.getAddElementId()); From 6eaa6f423e498b8253fb07f7ea37c7032ac1611a Mon Sep 17 00:00:00 2001 From: lopez <patrice.lopez@science-miner.com> Date: Thu, 21 Dec 2023 17:23:28 +0100 Subject: [PATCH 4/4] other typo for coords; exclude p --- .../main/java/org/grobid/core/data/BiblioItem.java | 14 +++++++------- .../src/main/resources/web/grobid/grobid.js | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/grobid-core/src/main/java/org/grobid/core/data/BiblioItem.java b/grobid-core/src/main/java/org/grobid/core/data/BiblioItem.java index cba7339326..a6ef634103 100755 --- a/grobid-core/src/main/java/org/grobid/core/data/BiblioItem.java +++ b/grobid-core/src/main/java/org/grobid/core/data/BiblioItem.java @@ -2263,7 +2263,7 @@ public String toTEI(int n, int indent, GrobidAnalysisConfig config) { if (titleTokens != null && titleTokens.size()>0) { String coords = LayoutTokensUtil.getCoordsString(titleTokens); if (coords != null && coords.length()>0) { - tei.append(" coord=\"" + coords + "\""); + tei.append(" coords=\"" + coords + "\""); } } } @@ -2276,7 +2276,7 @@ public String toTEI(int n, int indent, GrobidAnalysisConfig config) { if (titleTokens != null && titleTokens.size()>0) { String coords = LayoutTokensUtil.getCoordsString(titleTokens); if (coords != null && coords.length()>0) { - tei.append(" coord=\"" + coords + "\""); + tei.append(" coords=\"" + coords + "\""); } } } @@ -2426,7 +2426,7 @@ else if (bookTitle == null) { if (titleTokens != null && titleTokens.size()>0) { String coords = LayoutTokensUtil.getCoordsString(titleTokens); if (coords != null && coords.length()>0) { - tei.append(" coord=\"" + coords + "\""); + tei.append(" coords=\"" + coords + "\""); } } } @@ -2450,7 +2450,7 @@ else if (bookTitle == null) { if (titleTokens != null && titleTokens.size()>0) { String coords = LayoutTokensUtil.getCoordsString(titleTokens); if (coords != null && coords.length()>0) { - tei.append(" coord=\"" + coords + "\""); + tei.append(" coords=\"" + coords + "\""); } } } @@ -2682,7 +2682,7 @@ else if (this.getYear().length() == 4) if (titleTokens != null && titleTokens.size()>0) { String coords = LayoutTokensUtil.getCoordsString(titleTokens); if (coords != null && coords.length()>0) { - tei.append(" coord=\"" + coords + "\""); + tei.append(" coords=\"" + coords + "\""); } } } @@ -2709,7 +2709,7 @@ else if (this.getYear().length() == 4) if (titleTokens != null && titleTokens.size()>0) { String coords = LayoutTokensUtil.getCoordsString(titleTokens); if (coords != null && coords.length()>0) { - tei.append(" coord=\"" + coords + "\""); + tei.append(" coords=\"" + coords + "\""); } } } @@ -3791,7 +3791,7 @@ private void appendAffiliation( List<LayoutToken> affTokens = aff.getLayoutTokens(); String coords = LayoutTokensUtil.getCoordsString(affTokens); if (coords != null && coords.length()>0) { - tei.append(" coord=\"" + coords + "\""); + tei.append(" coords=\"" + coords + "\""); } } tei.append(">\n"); diff --git a/grobid-service/src/main/resources/web/grobid/grobid.js b/grobid-service/src/main/resources/web/grobid/grobid.js index aaf89ca926..a879790c27 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 = ['p', 's', 'biblStruct', 'persName', 'figure', 'formula', 'head', 'note', 'title']; + var elementCoords = ['s', 'biblStruct', 'persName', 'figure', 'formula', 'head', 'note', 'title']; function defineBaseURL(ext) { var baseUrl = null;