Package: onomaspy
onomaspyDeterministic classifier for personal namesusage: onomaspy [-h] [-v] [-F FILE] [-o tagged|csv|padded] [-t TRANSLITERATE]
                  [-u UNKNOWN_AS_FAMILY] [-b BREAK_FULL_NAMES]
                  givens_file families_file

  Deterministic classifier for personal names

  positional arguments:
    givens_file           givens filename
    families_file         families filename

  optional arguments:
    -h, --help            show this help message and exit
    -v, --version         show program's version number and exit
    -F FILE, --file FILE  input filename
    -o tagged|csv|padded, --output-format tagged|csv|padded
                          output format. `tagged` by default
    -t TRANSLITERATE, --transliterate TRANSLITERATE
                          transliterate names
    -u UNKNOWN_AS_FAMILY, --unknown-as-family UNKNOWN_AS_FAMILY
                          Treat unknown names as family names
    -b BREAK_FULL_NAMES, --break-full-names BREAK_FULL_NAMES
                          Force split of ambiguous full namesTL;DRonomasticis an algorithm for classifying personal names deterministically, using given and family names lists.onomastictries to minimize misclassifications, and does not make inferences about ambiguous personal names unless forced to do so.Sample usage:$echo"Bulgarelli Manfroni Franco Leonardo"|onomastic--givenstest/data/givens.txt--familiestest/data/families.txt--bonusgiven-utb
GivenAndFamily:FrancoLeonardo,BulgarelliManfroniIt offers both a python andhaskellimplementation. It can be used as a library or command-line command.The problemHuman names - akapersonal names- are usually composed of many individual names - first name, middle name, last name, for example - which can be grouped into two main sections: givens names and family names.There is no single way of properly writing a personal name - the proper order f individual names may even vary from culture to culture. For example, two common formats are display-order and sort-order:Thanks to those common and easily recognizable formats, it is simple to analyse a string that represents a name and infer which parts correspond to the given names and family names. For example:There are a lot of good packages that effectively perform this task using parsers or regular expressions:namaename-parsernameparserHowever, people do not always follow those conventions when they manually enter personal names. It is common to deal with lists like the following:In such situations, format-based algorithms will not solve our problem. You need something that actually undestands about individual names. Although you could use a machine learning algorithm -see this article- improper classification of personal names can be a sensible thing. Also, getting a big list of real names can turn into troubles.Because of this using a deterministic algorithm that only requires datasets of given and family names - and not just personal names - is a better approach.The solutiononomasticclassifies personal names using given and families list, which can be obtained from different sources depending your country or location.onomasticis designed to classify names only when they are not ambiguous, but this restriction can be relaxed using different flags.UsageAvailable options-g, --givensonomasticneeds a list of given names, one name per line. The givens file content should look like the following:Alvesio
Alvia
Alvida
Alvin
Alvina
Alvis
Alvita
Alys
Alysa
Alyson
Alyssa
Alzena
Amabel
Amabelia
Amabelio
Amable
Amada
AmadeoThis is a requied option.-f,--familiesonomasticneeds a list of family names - aka surnames -, one name per line. The families file content should look like the following:Acasio
Accino
Accorinti
Acebo
Aceituno
Acero
Aceval
Acevedo
Aceñero
Acha
Achacata
Achaval
Achemon
Achilli
AchucarroThis is a requied option.-F,--file-o,--output-formatOutput format {tagged|csv|padded}. Default is 'tagged'-B,--bonus BONUSTry to maximize length of a name group. Options are {no|given|family}. Default is 'no'-t,--transliterateTransliterate names before classifying them-u,--unknown-as-familyTreat unknown names as family names-b,--break-full-namesForce split of ambiguous full namesExamples$echo"Franco Bulgarelli"|onomastic--givenstest/data/givens.txt--familiestest/data/families.txt-ut
GivenAndFamily:Franco,Bulgarelli

$echo"Franco Bulgarelli Manfroni"|onomastic--givenstest/data/givens.txt--familiestest/data/families.txt-ut
GivenAndFamily:Franco,BulgarelliManfroni# some ambiguous splits will be prevented by default$echo"Bulgarelli Manfroni Franco Leonardo"|onomastic--givenstest/data/givens.txt--familiestest/data/families.txt-ut
FullName:BulgarelliManfroniFrancoLeonardo# however you can force them using the -b flag$echo"Bulgarelli Manfroni Franco Leonardo"|onomastic--givenstest/data/givens.txt--familiestest/data/families.txt-utb
GivenAndFamily:Leonardo,BulgarelliManfroniFranco

$echo"Feldfeber Kivelski Ivana"|onomastic--givenstest/data/givens.txt--familiestest/data/families.txt-ut
GivenAndFamily:Ivana,FeldfeberKivelski

$echo"Julian Berbel Alt"|onomastic--givenstest/data/givens.txt--familiestest/data/families.txt-ut
GivenAndFamily:Julian,BerbelAlt

$echo"BERBEL ALT julian"|onomastic--givenstest/data/givens.txt--familiestest/data/families.txt-ut
GivenAndFamily:Julian,BerbelAlt

$echo"Finzi Nadia Giselle"|onomastic--givenstest/data/givens.txt--familiestest/data/families.txt-ut
GivenAndFamily:NadiaGiselle,Finzi

$echo"Bulgarelli Manfroni Franco Leonardo"|onomastic--givenstest/data/givens.txt--familiestest/data/families.txt--bonusfamily-utb
GivenAndFamily:Leonardo,BulgarelliManfroniFranco

$echo"Bulgarelli Manfroni Franco Leonardo"|onomastic--givenstest/data/givens.txt--familiestest/data/families.txt--bonusgiven-utb
GivenAndFamily:FrancoLeonardo,BulgarelliManfroniCaveats and future workonomasticis far from perfect. It does currently not deal with:titles, initials and nicknamesgendercompound names likeJuan CruzorMaría de los AngelesDevelopmentInstallationTL;DR setup:$./devinitBasic setup:# Create and active a virtual env$python3-mvenv.venv
$source.venv/bin/activate# install the project$pipinstall-e.Install testing dependencies:$pipinstall-e.[testing]Installtoxfor full test, build and publish lifecycle:$pipinstalltoxRun tests# basic, quick run$pytest# run as part of standard tox lifecycle$toxPublish project# update package version in setup.cfg# them run these command:$gittag<version>
$gitpushoriginHEAD--tags# clean project$tox-eclean# build the package$tox-ebuild# publish to test.pypi$tox-epublish# publish to real pypi$tox-e--publish----repositorypypi