Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Russian name official order handling #154

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add some checks against name components being None.
Signed-off-by: Alexander Zarubkin <[email protected]>
Alexander Zarubkin committed May 27, 2024
commit 58a09502508e87655b02b128610877680accb198
6 changes: 3 additions & 3 deletions nameparser/parser.py
Original file line number Diff line number Diff line change
@@ -581,12 +581,12 @@ def handle_russian_name_specifics(self):
# OR if the last name looks like a russian patronymic
# (but it will break on name without patronymic and foreign last name like Olurombi Alexey <- Last First order),
# Another case: Last First instead of First Last. Then middle is empty.
is_name_order_lfm = self.is_russian_last_name(self.first) or (
is_name_order_lfm = (self.first and self.is_russian_last_name(self.first)) or (
# if the middle name also looks like a russian patronymic, then it's a First Middle Last order,
# e.g. Roman Alexeevich Abramovich <- Abramovich does look like patronymic, but it's really a last name
self.is_russian_patronymic(self.last) and not self.is_russian_patronymic(self.middle)
self.last and self.is_russian_patronymic(self.last) and not self.is_russian_patronymic(self.middle)
) or ( # some Russian citizens have patronymics of turkic origin, e.g. Said Ogly
self.is_turkic_patronymic(self.last)
self.last and self.is_turkic_patronymic(self.last)
)

# rare case: last name consists of two or more words separated by space