Skip to content

Commit

Permalink
Update AuthorUtils.java for resolution of issue 189 in GH Issues (#190)
Browse files Browse the repository at this point in the history
* Update AuthorUtils.java for resolution of issue 189 in GH Issues

* Fix spacing (use tabs)

Co-authored-by: Nemanja Martinovic <nemanja.martinovic@cfa.harvard.edu>
  • Loading branch information
nemanjamart and Nemanja Martinovic committed Sep 14, 2022
1 parent 6873138 commit 960d907
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,22 +297,28 @@ static Set<String> transliterateRussianName(String name) {
}
}
}

// then modify first names (possibly multi-plying output)
String rfn = StringUtils.reverse(first.toString());
result = trie.search(first.toString());
if (result != null) {
// collect the set of surname synonyms
HashSet<String> surnames = new HashSet<String>();
for (String o: out) {
parts = splitName(o);
surnames.add(parts[0]);
}
// combine each first name synonym with each surname synonym
for (String x: result.result.transform(rfn, result.suffix)) {
x = StringUtils.reverse(x);
for (String o: out) {
parts = splitName(o);
out.add(parts[0] + " " + x);
};
for (String rsurname: surnames) {
out.add(rsurname + " " + x);
}
}
}
out.remove(name); // remove the original
return out;

}

/*
Expand Down

0 comments on commit 960d907

Please sign in to comment.