Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions grobid-core/src/main/java/org/grobid/core/data/Figure.java
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public String toTEI(GrobidAnalysisConfig config, Document doc, TEIFormatter form
addXmlId(desc, "_" + divID);
}

// if the segment has been parsed with the full text model we further extract the clusters
// if the segment has been parsed with the full-text model, we further extract the clusters
// to get the bibliographical references
if (StringUtils.isNotBlank(labeledCaption)) {
TaggingTokenClusteror clusteror = new TaggingTokenClusteror(GrobidModels.FULLTEXT, labeledCaption, captionLayoutTokens);
Expand Down Expand Up @@ -432,19 +432,17 @@ public String toTEI(GrobidAnalysisConfig config, Document doc, TEIFormatter form

if (StringUtils.isNotBlank(desc.getValue()) && config.isWithSentenceSegmentation()) {
formatter.segmentIntoSentences(desc, this.captionLayoutTokens, config, doc.getLanguage(), doc.getPDFAnnotations());
}

// we need a sentence segmentation of the figure caption, for that we need to introduce
// a <div>, then a <p>
desc.setLocalName("p");
desc.setLocalName("p");

Element div = XmlBuilderUtils.teiElement("div");
div.appendChild(desc);
Element div = XmlBuilderUtils.teiElement("div");
div.appendChild(desc);

Element figDesc = XmlBuilderUtils.teiElement("figDesc");
figDesc.appendChild(div);
Element figDesc = XmlBuilderUtils.teiElement("figDesc");
figDesc.appendChild(div);

desc = figDesc;
}
desc = figDesc;

figureElement.appendChild(desc);
}
Expand Down
17 changes: 7 additions & 10 deletions grobid-core/src/main/java/org/grobid/core/data/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,16 @@ public String toTEI(GrobidAnalysisConfig config, Document doc, TEIFormatter form

if (StringUtils.isNotBlank(desc.getValue()) && config.isWithSentenceSegmentation()) {
formatter.segmentIntoSentences(desc, this.captionLayoutTokens, config, doc.getLanguage(), doc.getPDFAnnotations());
}
desc.setLocalName("p");

// we need a sentence segmentation of the table caption, for that we need to introduce
// a <div>, then a <p>
desc.setLocalName("p");

Element div = XmlBuilderUtils.teiElement("div");
div.appendChild(desc);
Element div = XmlBuilderUtils.teiElement("div");
div.appendChild(desc);

Element figDesc = XmlBuilderUtils.teiElement("figDesc");
figDesc.appendChild(div);
Element figDesc = XmlBuilderUtils.teiElement("figDesc");
figDesc.appendChild(div);

desc = figDesc;
}
desc = figDesc;
}
} else {
desc.appendChild(LayoutTokensUtil.normalizeText(caption.toString()).trim());
Expand Down