Skip to content

Commit

Permalink
Update persian_names.py
Browse files Browse the repository at this point in the history
  • Loading branch information
armanyazdi committed Mar 10, 2023
1 parent f888556 commit 500bd89
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions persian_names/persian_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ def firstname_en(sex='r'):
def lastname_en():
# English Prefixes and Suffixes
some_prefixes = [
'', '', '', '',
'', '', '', '', '',
'Mir',
'Agha',
'Pour',
'Nour',
'Shah',
'Haj',
'Haji',
Expand Down Expand Up @@ -103,6 +105,8 @@ def lastname_en():
last_name = prefix + last_name.lower()
else:
last_name += suffix
elif (len(last_name) <= 5 and last_name[-1] == 'i') or last_name.lower().endswith('ali') or last_name.lower().endswith('mahdi'):
last_name += ['pour', 'zadeh', 'far', 'fard', 'an', 'kia', 'khani', 'vand', 'nia', 'nejad', 'beigi'][randrange(11)]
elif len(last_name) > 10 and last_name[-1] == 'i':
last_name += ''
elif len(last_name) > 10 and last_name[-1] != 'i':
Expand All @@ -112,9 +116,6 @@ def lastname_en():
else:
last_name += more_suffixes[randrange(len(more_suffixes))]

while last_name.lower().endswith('ali') or last_name.lower().endswith('mahdi') or last_name == 'Mani' or last_name == 'Gholi':
last_name += some_suffixes[randrange(len(some_suffixes))]

return last_name


Expand Down Expand Up @@ -145,9 +146,11 @@ def firstname_fa(sex='r'):
def lastname_fa():
# Farsi Prefixes and Suffixes
some_prefixes = [
'', '', '', '',
'', '', '', '', '',
'میر',
'آقا',
'پور',
'نور',
'شاه ',
'حاج ',
'حاجی ',
Expand Down Expand Up @@ -218,15 +221,13 @@ def lastname_fa():
last_name = prefix + last_name
else:
last_name += suffix

elif (len(last_name) <= 4 and last_name[-1] == 'ی') or last_name.endswith('علی') or last_name.endswith('مهدی'):
last_name += [' پور', ' زاده', ' فر', ' فرد', 'ان', ' کیا', ' خانی', ' وند', ' نیا', ' نژاد', ' بیگی'][randrange(11)]
elif last_name[-1] == 'ی':
last_name += some_suffixes[randrange(len(some_suffixes))]
else:
last_name += more_suffixes[randrange(len(more_suffixes))]

while last_name.endswith('علی') or last_name.endswith('مهدی') or last_name == 'مانی' or last_name == 'قلی':
last_name += some_suffixes[randrange(len(some_suffixes))]

return last_name


Expand Down

0 comments on commit 500bd89

Please sign in to comment.