diff --git a/CITATION.cff b/CITATION.cff index df1194d59..fb75f2407 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -9,4 +9,4 @@ authors: repository-code: "https://github.com/derek73/python-nameparser" url: "https://github.com/derek73/python-nameparser" license: LGPL-2.1-or-later -version: "3.1.0" +version: "3.2.0" diff --git a/README.rst b/README.rst index 2537165c3..8316334a3 100644 --- a/README.rst +++ b/README.rst @@ -28,9 +28,15 @@ compatibility layer:** patronymics, and family names written as letters or in capitals. * ``Parser.matching()`` groups and compares names from several sources. +📣 **nameparser 3.2 adds new vocabulary and locale packs.** Four packs +are new (Malay, Burmese, Dutch, Portugal), and three more now read two +family names (Croatian, Slovenian, Brazilian Portuguese). It also reads +a name written after ``@`` as a nickname, and a parse makes about a +third fewer function calls than in 3.1. + `Getting started `__ -takes you through both, and the `release log +takes you through ``suggest`` and ``matching``, and the `release log `__ has the details. Please `open an issue `__ for anything @@ -155,6 +161,8 @@ parser splits it off, with no configuration (see `Thai names ('นาย', 'สมชาย', 'ใจดี') >>> parse("г-н Иван Петров").title # Cyrillic title 'г-н' + >>> parse("श्री रवि कुमार वर्मा").title # Hindi: a Devanagari salutation + 'श्री' >>> arabic = parse("محمد بن سلمان") # Arabic: بن chains onto the family name >>> arabic.family, arabic.patronymic # and marks it a patronymic ('بن سلمان', 'بن سلمان') @@ -183,6 +191,11 @@ the patronymic in Russian. See `Locale packs >>> ivan = russian.parse("Сидоров Иван Петрович") >>> ivan.given, ivan.patronymic, ivan.family ('Иван', 'Петрович', 'Сидоров') + >>> parse("Shri Ravi Kumar Verma").given # romanized, Shri may be a name + 'Shri' + >>> hindi = parser_for(locales.HI) # the Hindi pack reads the salutation + >>> hindi.parse("Shri Ravi Kumar Verma").title + 'Shri' >>> locales.available() # every pack that ships ('ar', 'bn', 'cs', 'es', 'es_ar', 'ga', 'gd', 'he', 'hi', 'hr', 'ja', 'mn', 'ms', 'my', 'ne', 'nl', 'pt', 'pt_br', 'pt_pt', 'ru', 'sk', 'sl', 'tr_az', 'vi', 'zh') diff --git a/docs/migrate.rst b/docs/migrate.rst index da130572c..f5e90d3ce 100644 --- a/docs/migrate.rst +++ b/docs/migrate.rst @@ -2389,7 +2389,8 @@ A Latin bound given name past the first word ``Abdel``, ``Abd``, ``Abdal`` and ``Abou`` past the first word of a name now join the name word after them, and ``Abdul`` does too in a name -of four words or more. Position places the pair: the family name where +of four name words or more, a title, a suffix, a nickname or a maiden +name not counted. Position places the pair: the family name where it ends the name, one middle name inside it. 1.4 through 3.1 read the bound word as a middle name of its own, or, for ``Abd`` in the given part after a family comma, as the credential ABD, and the word after it diff --git a/docs/release_log.rst b/docs/release_log.rst index 44cbc49eb..1bd9a5672 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -1,8 +1,8 @@ Release Log =========== -* 3.2.0 - Unreleased +* 3.2.0 - November 22, 2026 - nameparser 3.2 is under development. + **nameparser 3.2** adds four locale packs: ``locales.MS`` for Malay names, ``locales.MY`` for Burmese names, ``locales.NL`` for Dutch names and ``locales.PT_PT`` for names from Portugal. A second name written after ``@`` or ``urf`` is read as the nickname (``Rahim @ Jaki bin Osman``), ``a/l``, ``a/p`` and ``anak`` as patronymic particles, a job or degree written after a name and a comma as the title, and an Arabic title written short as the title. ``locales.HR``, ``locales.SL`` and ``locales.PT_BR`` now read two family names, and ``Parser.suggest()`` can suggest ``two_family_names`` for a list. A parse makes about a third fewer Python function calls than in 3.1, with no reading moved, and ``Lexicon.remove`` warns where an edit can take nothing. :doc:`migrate` lists the names whose reading moved, and which pickles load where. - **Read Imam, Timi, Sheriff and Effendi opening a name as the given name, as in Indonesia, Nigeria and West Africa.** ``parse("Imam Taufik Sasongko")`` gives given ``Imam``, middle ``Taufik``, family ``Sasongko``, where 1.4.0 through 3.1.0 gave title ``Imam``, given ``Taufik``; in a title phrase each stays the title (``Chief Imam``, ``Grand Imam``, ``Sheriff Principal``, ``Timi of Ede``), and a cleric written with the bare title before his name reads it as the given name too, as does the word written alone after a full name and a comma (``Kanteh Jallow, Sheriff`` gives given ``Sheriff``, family ``Kanteh Jallow``). :issue:`1206` - **Fix a title or suffix typed with a zero-width non-joiner or joiner at its edge, which read as a name word.** ``parse("Dr\u200c John Smith")`` gives title ``Dr\u200c``, given ``John``, where 1.4.0 through 3.1.0 gave given ``Dr\u200c``, middle ``John``; the Persian ``مهندس`` typed with a ZWNJ after it is the title the same way, and the name match reads a name typed with one as ``folded``. The field keeps the character, and one inside a word is still part of its spelling. A ``Lexicon`` pickled with a word added with one at its edge is refused on load. :issue:`1335` @@ -29,7 +29,7 @@ Release Log - **Fix an Arabic-script name written with الدين or الله second, which read as two names.** ``parse("نور الدين سامر حداد")`` gives given ``نور الدين``, where 1.4.0 through 3.1.0 gave given ``نور``, middle ``الدين سامر``; ending the name the pair is the family name, and ``الدین``, ``اله`` and ``اللہ`` read the same way; a name of two name words keeps them apart. ``Lexicon.add`` accepts a new kind, ``bound_second``, for such a word. :issue:`1072` - **Add Qari, Moulana, Alhaj and Alhajj as titles, the religious titles written before a name in Pakistan and Bangladesh.** ``parse("Qari Ahmed Khan")`` gives title ``Qari``, given ``Ahmed``, where 1.4.0 through 3.1.0 gave given ``Qari``, middle ``Ahmed``. ``Hafiz``, ``Hafez``, ``Haji`` and the spelling ``Maulana``, often borne as given names, still read as the given name by default (``locales.MS`` reads ``Haji`` as a title). :issue:`1469` - **Fix Abdel, Abd and Abou past the first word of a name, which read as a middle name of their own.** ``parse("Tariq Abdel Aziz")`` gives family ``Abdel Aziz``, where 1.4.0 through 3.1.0 gave middle ``Abdel``, family ``Aziz``. ``Abdul`` joins only in a name the parse reads as four name words or more, a title, a suffix, a nickname or a maiden name not counted, so ``Tariq Abdul Aziz`` keeps middle ``Abdul``; and after a family comma ``Abd`` before a name word is no longer the credential ABD. :issue:`1464`, :issue:`1531` - - **Add locales.MS, a Malay pack, and read the Malaysian honours Datuk, Dato', Datin and Hajah as titles.** ``parse("Datuk Ahmad bin Ali")`` gives title ``Datuk``, given ``Ahmad``, where 1.4.0 through 3.1.0 gave given ``Datuk``, middle ``Ahmad``; ``parser_for(locales.MS)`` also reads Puan, Cik, Ustaz, Ustazah, Cikgu, Tun, Haji and the phrases Tan Sri and Puan Sri as titles. Keep the pack to Malaysian names: it reads the Indonesian given name ``Puan`` and the Burmese given name ``Tun`` as titles (``Puan Maharani``); ``Tuan``, a hereditary prefix and a Vietnamese given name, stays a name word, and so do ``Tan`` and ``Sri`` outside their phrase, each with a ``title-or-name`` report. ``Sri`` or ``Seri`` written behind another honour stays a name word, by default and under the pack (``Datuk Seri Anwar Ibrahim`` gives given ``Seri``). See :ref:`malay-names`. :issue:`1179`, :issue:`1180` + - **Add locales.MS, a Malay pack, and read the Malaysian honours Datuk, Dato', Datin and Hajah as titles.** ``parse("Datuk Ahmad bin Ali")`` gives title ``Datuk``, given ``Ahmad``, where 1.4.0 through 3.1.0 gave given ``Datuk``, middle ``Ahmad``; ``parser_for(locales.MS)`` also reads Puan, Cik, Ustaz, Ustazah, Cikgu, Tun, Haji and the phrases Tan Sri and Puan Sri as titles. Keep the pack to Malaysian names: it reads the Indonesian given name ``Puan`` and the Burmese given name ``Tun`` as titles (``Puan Maharani``); ``Tuan``, a hereditary prefix and a Vietnamese given name, stays a name word, unreported; ``Tan`` and ``Sri`` outside their phrase stay name words too, and opening a name each records a ``title-or-name`` report. ``Sri`` or ``Seri`` written behind another honour stays a name word, by default and under the pack (``Datuk Seri Anwar Ibrahim`` gives given ``Seri``). See :ref:`malay-names`. :issue:`1179`, :issue:`1180` - **Change Parser.suggest() to suggest two_family_names for a list whose names end in two family names, and add Signal.FIRST_SURNAME, the signal that votes for it.** ``Parser().suggest(["María García López", "Juan Pérez Ruiz", "Ana Martínez Soto"]).patch`` gives ``PolicyPatch(two_family_names=True)``, where 3.1.0 suggested nothing; it is weighed only where the list's order is given-first, and lists measured from Argentina, Brazil and Portugal are rarely or never suggested it. ``NameEvidence.votes`` may now hold ``True`` or ``False``, the switch's value a name votes for. :issue:`1452` - **Fix Arabic titles written short, which read as the given name, and stop giving initials for Arabic-script names.** ``parse("د. أحمد علي حسن")`` gives title ``د.``, given ``أحمد``, where 1.4.0 through 3.1.0 gave given ``د.``; ``أ.د.``, ``م.م.``, a title glued to the name and the ranks ``اللواء`` and ``المستشار`` read as titles too, and ``initials()`` gives nothing for a word in Arabic script, as for Thai and Burmese, nor does the name match read its letter as an initial. A title written with a slash for its full stop reads as the title too, in any script (``د/ أحمد``, ``Dr/Jane Smith``), where 1.4.0 through 3.1.0 read the given name. :issue:`1149` - **Change Parser.suggest() to read where a Russian-style patronymic stands as a vote on the order, and add Signal.PATRONYMIC_POSITION, the signal that casts it.** ``Parser().suggest(["Sidorov Ivan Petrovich", "Volkov Pavel Sergeevich", "Orlova Anna Ivanovna", "Zaitsev Oleg Nikolaevich", "Belova Vera Andreevna"]).patch`` gives ``PolicyPatch(name_order=FAMILY_FIRST, patronymic_rules=...)``, where 3.1.0 gave the rule with the given-first order, which misread any name of two words in such a list (``Sidorov Ivan`` gave family ``Ivan``); a patronymic in the middle votes given-first. :issue:`1447` @@ -47,6 +47,8 @@ Release Log - **Change locales.PT_BR to read two family names, and add locales.PT_PT, which reads names from Portugal the same way.** ``parser_for(locales.PT_BR).parse("Ana Souza Lima")`` gives family ``Souza Lima``, where 3.0.0 through 3.1.0 gave middle ``Souza``, family ``Lima``; a second given name on the packs' Portuguese given-name list stays where it stands (``Ana Beatriz Costa`` keeps family ``Costa``), and ``locales.PT``, chosen for Portuguese names from any country, is unchanged. ``locales.PT_PT`` also reads four given names Portugal writes behind a particle and Brazil does not (``Maria do Rosário Pinto`` gives middle ``do Rosário``, as ``do Carmo``, ``da Conceição`` and ``da Luz`` do). :issue:`1453`, :issue:`1189` - **Change the Spanish given-name lists, rewritten from their tool.** ``parser_for(locales.ES_AR).parse("Juan Gerhard Lopez")`` gives family ``Gerhard Lopez``, where 3.0.0 through 3.1.0 gave middle ``Gerhard``; nine words leave locales.ES_AR's list (``Gerhard``, ``Zuleyma`` among them) and nine join it (``Azhar``, ``Houari``, ``Grace``), each joining reading as a middle name where it read as the first family name, and locales.ES's gains ``Lahcen`` and drops ``Rim``. :issue:`1471`, :issue:`1476` - **Add a warning when Lexicon.remove names a reading no vocabulary file holds, which took nothing and said nothing.** ``Lexicon.default().remove("alhaj", kind="religious")`` now warns ``remove('alhaj', kind='religious') changes nothing: 'alhaj' has no 'religious' reading in any vocabulary file or earlier add(); it holds: style. Did you mean remove('alhaj', kind='style')?``, where 3.0.0 through 3.1.0 returned the lexicon unchanged in silence. A fragment that removes a word another lexicon adds, when the two are joined, warns too, since the call cannot see that lexicon. :issue:`1535` + - **Change parsing to make about a third fewer Python function calls, with no reading moved.** A parse of the reference name ``Dr. Juan0001 de la Vega III`` makes 195.72 calls on Python 3.11, averaged over 50 such names (``Juan0000`` to ``Juan0049``), where 3.1.0 made 285.72 (186.72 against 277.72 on Python 3.15); the calls were counted, not timed. :issue:`1435`, :issue:`1436` + - **Change pickles: a Lexicon, Parser or name matcher pickled by 3.2 does not load under 3.1.** Under 3.1.0 ``pickle.loads`` raises ``ValueError`` for one, its vocabulary holding a reading kind 3.1 does not know (``alias_marker``), where a ``Policy``, ``PolicyPatch``, locale pack, ``ParsedName`` or ``Ambiguity`` loads both ways; everything 3.1 pickled loads under 3.2, save a ``Lexicon`` holding a word added with a zero-width non-joiner or joiner at its edge. See :ref:`migrate-pickles`. :issue:`1164`, :issue:`1335` * 3.1.0 - November 16, 2026 diff --git a/nameparser/_version.py b/nameparser/_version.py index b4aa2e9d0..a5db37eb3 100644 --- a/nameparser/_version.py +++ b/nameparser/_version.py @@ -15,5 +15,5 @@ #: "dev" through the cycle, cleared at release. It normalizes to #: 3.2.0.dev0, which sorts above 3.1.0 and BELOW 3.2.0, so an install #: from master can never masquerade as the release it precedes. -PRE_RELEASE = "dev" +PRE_RELEASE = "" __version__ = ".".join(map(str, VERSION)) + PRE_RELEASE