Skip to content

More position titles in capitals, wider test set (v3.1.18) - #85

Merged
click0 merged 1 commit into
mainfrom
claude/refactor-data-masking-lIcWN
Oct 16, 2026
Merged

click0 merged 1 commit into
mainfrom
claude/refactor-data-masking-lIcWN

Conversation

@click0

@click0 click0 commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #84 ("position titles in capitals taken for a name"): a wider probe of titles, unit names, headings and real names in capitals found four gaps in the 3.1.17 rules and gives the fix a test set of 106 cases.

Input 3.1.17 Now
з посади СТАРШОГО ОПЕРАТОРА РОЗРАХУНКУ СТАРШОГО ОПЕРІЙЧА РОМАНУ (rejected from the 1st word, taken again from the 2nd) unchanged
на посаду ОПЕРАТОРА ВІДДІЛЕННЯ БЕЗПІЛОТНИХ АВІАЦІЙНИХ КОМПЛЕКСІВ … БЕЗПІЛОТНИХ АВІВІЄНКО КОСТЯНТИН unchanged
на посаду Оператора Відділення Безпілотних Авіаційних Комплексів … Безипенко Андрій Миронович unchanged
на посаду ПОМІЧНИКА ГРАНАТОМЕТНИКА, медаллю ЗАХИСНИКУ ВІТЧИЗНИ, відзнакою ЗА ВІЙСЬКОВУ ДОБЛЕСТЬ surname + first name unchanged
КОВАЛЬ ТЕТЯНА — ІВАНОВ ПЕТРО not masked (heading rule) both names masked

Rules

  • Block of capitals counted in both directions (_caps_block_without_patronymic): any candidate inside a run of three or more words in capitals without a patronymic is a title.
  • A first name in -их / -ів (Авіаційних, Комплексів) must be a known name (Яків), otherwise the candidate is not a name.
  • Two words in capitals without a rank and without a patronymic are a name only when the second word is a known first name (КОВАЛЬ ТЕТЯНА, ПЕТРЕНКО ЗИНОВІЙ, КОВАЛЬ ЯКІВ). Trade-off: ПЕТРЕНКО АЙДЕР (a rare first name, capitals, no rank, no patronymic) is no longer masked; Петренко Айдер and рядового ПЕТРЕНКА АЙДЕРА still are.
  • A line in capitals is a heading only without a known first name next to another word: НАКАЗ КОМАНДИРА ВІЙСЬКОВОЇ ЧАСТИНИ, ВІРА НАДІЯ ЛЮБОВ stay headings, КОВАЛЬ ТЕТЯНА — ІВАНОВ ПЕТРО is a list of people.
  • Known limitation (kept as a test): in ВРУЧИТИ ГРАМОТУ ОЛЕГУ ПЕТРОВИЧУ ПЕТРЕНКУ the first name and patronymic are masked, the surname after them is not — a word in capitals before a name-first order cannot be told from a surname.

Tests

tests/test_position_titles.py — 106 cases: 22 position titles in capitals, 5 in title case, 9 headings and award names, a whole order (titles plus three real names and a signature), 32 real names in capitals (tables, tabs, quotes, ПІБ: label, dates and IDs, initials, name-first order, shifted window, two-word names, ranks, mixed case), the trade-off and the limitation, and the helper rules.

Verification

  • pytest: 1533 passed, 1 skipped; mypy 0 errors; flake8 clean.
  • Round-trip fuzzer 1500 documents and leak fuzzer 800 documents: no failures.
  • Mask diff against main on 150 generated documents: identical.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XT6iUWaQgahXDB9TWX9Bq7


Generated by Claude Code

Probing more titles found gaps in the 3.1.17 rules:
- the block of capitals was counted only from the candidate onwards, so
  "з посади СТАРШОГО ОПЕРАТОРА РОЗРАХУНКУ" was rejected from the first
  word and taken again from the second; the block is now counted in both
  directions (_caps_block_without_patronymic);
- a first name in -их/-ів (Авіаційних, Комплексів) must be a known name
  (Яків), so "Оператора Відділення Безпілотних Авіаційних Комплексів"
  stays in capitals and in title case;
- two words in capitals without a rank and without a patronymic are a name
  only when the second word is a known first name (КОВАЛЬ ТЕТЯНА, ПЕТРЕНКО
  ЗИНОВІЙ): ПОМІЧНИКА ГРАНАТОМЕТНИКА, ЗАХИСНИКУ ВІТЧИЗНИ, ЗА ВІЙСЬКОВУ
  ДОБЛЕСТЬ were surname + first name. Trade-off: ПЕТРЕНКО АЙДЕР (rare
  first name, capitals, no rank) is no longer masked; Петренко Айдер and
  рядового ПЕТРЕНКА АЙДЕРА still are;
- a line in capitals is a heading only without a known first name next to
  another word: КОВАЛЬ ТЕТЯНА — ІВАНОВ ПЕТРО is masked, НАКАЗ КОМАНДИРА
  ВІЙСЬКОВОЇ ЧАСТИНИ and ВІРА НАДІЯ ЛЮБОВ are not.

Known limitation: in "ВРУЧИТИ ГРАМОТУ ОЛЕГУ ПЕТРОВИЧУ ПЕТРЕНКУ" the first
name and patronymic are masked, the surname after them is not — a word in
capitals before a name-first order cannot be told from a surname.

tests/test_position_titles.py: 106 cases — titles and unit names in
capitals and title case, headings, award names, a whole order, real names
in capitals in tables, with tabs, quotes, labels, dates and IDs, initials,
name-first order, shifted windows, two-word names, ranks, helper rules.
Masks of generated documents unchanged (0 of 150 differ from main);
round-trip fuzzer 1500 and leak fuzzer 800 documents clean.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XT6iUWaQgahXDB9TWX9Bq7
Generated-With: Claude Code 2.1.42
@click0
click0 merged commit f9e1f91 into main Oct 16, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants