Skip to content

Commit

Permalink
Fix empty lastname
Browse files Browse the repository at this point in the history
If only a firstname is detected, use it without lastname.
  • Loading branch information
Benedikt Tutzer committed Aug 1, 2021
1 parent c1afa0a commit 2a69fa4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions grobid-core/src/main/java/org/grobid/core/data/BiblioItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -1922,12 +1922,19 @@ public String toBibTeX(String id, GrobidAnalysisConfig config) {
fullAuthors.stream()
.filter(person -> person != null)
.forEachOrdered(person -> {
String author = person.getLastName();
String author = "";
if (person.getLastName() != null) {
author = person.getLastName();
}
if (person.getFirstName() != null) {
author += ", ";
if (author.length() > 0) {
author += ", ";
}
author += person.getFirstName();
}
authors.add(author);
if (author.length() > 0 ) {
authors.add(author);
}
});
} else if (this.authors != null) {
StringTokenizer st = new StringTokenizer(this.authors, ";");
Expand Down

0 comments on commit 2a69fa4

Please sign in to comment.