Skip to content

Commit

Permalink
fix error case with empty affiliation when creating pre-annotated tra…
Browse files Browse the repository at this point in the history
…ining
  • Loading branch information
kermitt2 committed Feb 18, 2024
1 parent 3893a8d commit d4822e1
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1370,11 +1370,14 @@ public Document createTraining(File inputFile,
List<List<LayoutToken>> tokenizationsAffiliation = resHeader.getAffiliationAddresslabeledTokens();
//List<LayoutToken> tokenizationsAffiliation = resHeader.getLayoutTokens(TaggingLabels.HEADER_AFFILIATION);
List<LayoutToken> tokenizationAffiliation = new ArrayList<>();
for (List<LayoutToken> tokenization : tokenizationsAffiliation) {
tokenizationAffiliation.addAll(tokenization);
StringBuilder bufferAffiliation = null;
if (tokenizationsAffiliation != null && tokenizationsAffiliation.size()>0) {
for (List<LayoutToken> tokenization : tokenizationsAffiliation) {
tokenizationAffiliation.addAll(tokenization);
}
bufferAffiliation =
parsers.getAffiliationAddressParser().trainingExtraction(tokenizationAffiliation);
}
StringBuilder bufferAffiliation =
parsers.getAffiliationAddressParser().trainingExtraction(tokenizationAffiliation);

// buffer for the date block
StringBuilder bufferDate = null;
Expand Down

0 comments on commit d4822e1

Please sign in to comment.