Skip to content

names/prefix: single prefix-stripping implementation #238

Description

@pudo

Honorific/name-prefix stripping is implemented twice, once per language:

  • rust/src/names/prefix.rs — remove_person_prefixes / remove_org_prefixes / remove_obj_prefixes, consumed only by the Rust analyze_names pipeline (names/analyze.rs). Not exported via PyO3.
  • rigour/names/prefix.py — public API (re-exported from rigour.names), used downstream by followthemoney (compare.py) and nomenklatura (match.py, compat.py).

Both independently build the identical ^\W*((alt|…)\.?\s+)* case-insensitive regex from the same _core prefix lists, but one goes through Rust regex and the other through Python re. Any drift in escaping or case-folding semantics would silently desync the public helpers from the analyze pipeline.

Proposed fix: export the three Rust functions through _core (+ stub entries in rigour/_core.pyi) and turn rigour/names/prefix.py into a thin wrapper, leaving one implementation.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions