Fix inline letter suffix dropped from house number by webzuweb · Pull Request #154 · natasha/natasha · GitHub
Skip to content

Fix inline letter suffix dropped from house number - #154

Merged
kuk merged 1 commit into
natasha:masterfrom
webzuweb:fix/inline-literal-house-number
Oct 1, 2026
Merged

kuk merged 1 commit into
natasha:masterfrom
webzuweb:fix/inline-literal-house-number

Conversation

@webzuweb

Copy link
Copy Markdown
Contributor

Summary\n\nFixes #125.\n\nDOM_VALUE only matched a bare integer, so an inline literal such as д. 20А was parsed as дом «20» plus a stray unparsed «А» (surfacing as a varchar part). This PR makes the house number use ADDR_VALUE (which already permits an optional letter suffix), so д. 20А now yields дом «20А».\n\nThe separate form д. 20, литера А continues to parse as дом «20» + литера «А» (its own part).\n\n## Changes\n\n- natasha/grammars/addr.py: DOM_VALUE now uses ADDR_VALUE instead of a bare INT.\n- tests/test_addr.py: added a case for г. Москва, ул. Ленина, д. 20А → дом «20А».\n\n## Testing\n\npytest tests/test_addr.py — the new case passes; the 14 pre-existing failures are unrelated (FIAS type-register drift on master, also failing without this change).

DOM_VALUE only matched a bare INT, so an inline literal like 'д. 20А' was parsed as дом '20' plus a stray unparsed 'А' (varchar). Use ADDR_VALUE (which already allows an optional letter suffix) for the house number, so 'д. 20А' yields дом '20А' while the separate 'литера А' form still parses as its own part (fixes natasha#125).
@kuk
kuk merged commit 3602835 into natasha:master Oct 1, 2026
0 of 4 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