Skip to content

fix(extraction): treat the en-dash as a clause boundary too, and pin hyphen non-boundary#65

Open
RobertSigmundsson wants to merge 1 commit into
acidkill:mainfrom
RobertSigmundsson:upstream-pr/en-dash-clause-boundary
Open

fix(extraction): treat the en-dash as a clause boundary too, and pin hyphen non-boundary#65
RobertSigmundsson wants to merge 1 commit into
acidkill:mainfrom
RobertSigmundsson:upstream-pr/en-dash-clause-boundary

Conversation

@RobertSigmundsson

Copy link
Copy Markdown
Contributor

Hi Toni!

The two non-blockers you flagged on #57, folded into one small change.

En-dash as a clause boundary

_CLAUSE_BOUNDARY had the em-dash (—) but not the en-dash (–, U+2013). Editors and operating systems emit the en-dash just as often for ranges and asides, so the same cross-clause junk bigram the em-dash fix targets (a filename fragment glued onto the next clause) still slipped through when the separator was an en-dash. Added it to the set.

Hyphen non-boundary — now pinned

You noted the hyphen-non-boundary behaviour had no dedicated test. Added one: a plain ASCII hyphen must NOT split a clause, so compound halves like cache-aside still pair as a bigram — kept as an explicit contrast to the en-/em-dash, which do split.

Type of Change

  • Bug fix + regression test (non-breaking)

Testing

  • test_no_bigram_across_en_dash and test_hyphen_is_not_a_clause_boundary added to TestClauseBoundaryBigrams.
  • Full unit suite (rebased on main): 6,082 passed, 33 skipped in ~30 s (-n0). ruff + mypy clean. (The literal en-dash in the regex and one test string carry a # noqa: RUF001 — ruff flags a bare en-dash as confusable with a hyphen, but here we want it literal.)

Note on the ma/na/co/sa question (separate)

I ran the collision audit you suggested for the four Polish stop-words; it points at a different fix than removal (the N/A/S.A. collisions don't actually reproduce), so I opened #64 for that discussion rather than bundling it here.

Robert

…hyphen non-boundary

The clause-boundary set had the em-dash (—) but not the en-dash (–, U+2013),
which editors and operating systems emit just as often for ranges/asides. Without
it the same cross-clause junk bigram the em-dash fix targets slips through when the
separator happens to be an en-dash.

Add the en-dash to _CLAUSE_BOUNDARY and add two regression tests: one that no
bigram bridges an en-dash, and one that a plain ASCII hyphen is NOT a clause
boundary (compound halves like "cache-aside" must still pair).
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.

1 participant