Skip to content

Keep street address matches on one line - #116

Open
vamsibvv wants to merge 1 commit into
philterd:mainfrom
vamsibvv:street-address-single-line
Open

vamsibvv wants to merge 1 commit into
philterd:mainfrom
vamsibvv:street-address-single-line

Conversation

@vamsibvv

@vamsibvv vamsibvv commented Oct 30, 2026 •

Copy link
Copy Markdown

Fixes #115.

The street address pattern joined its parts with \s, so a match could span lines: in the issue's example, 50613\n\nDear Dr was detected as an address. The parts are now joined by [ \t]+, the same change as the Java fix in philterd/phileas#477, so a match stays on one line.

Tests cover the reproduction (one match, 214 Juniper Court), the ZIP and greeting lines joined by \n and by \r\n, a number and a street type on different lines, and multi-line address blocks where the street line is still found, including one with a unit. The reproduction test and the three new negative cases fail on main. The full suite passes (2399 passed, the model download e2e test not run).

One difference from before: Python's \s also matched a no-break space and other Unicode spaces, so 123 and Main Street joined by a no-break space (U+00A0) was detected and now is not, as in Java. If you'd rather keep those, [^\S\r\n] would do it; I kept [ \t] because the issue asks for Java's behavior.

AI assistance (Claude Code) was used for this change.

This branch has not been deployed

No deployments
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.

Street address filter matches across line breaks and reads "Dr." in a greeting as a street suffix

1 participant