Skip to content

Relevance filter: keep omnibus household bills; whole-word exclusions - #254

Open
DTrim99 wants to merge 2 commits into
review-followups-1204from
relevance-omnibus-exclusions
Open

DTrim99 wants to merge 2 commits into
review-followups-1204from
relevance-omnibus-exclusions

Conversation

@DTrim99

@DTrim99 DTrim99 commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #253 (review follow-ups); it targets that branch and should merge after it.

From Pavel's #250 review, suggestion 2: some exclusions in the OpenStates relevance filter drop realistic household bills. This predates #250, so it has its own PR.

What changes (scripts/openstates_monitor.py)

  • Sales tax and industry credits drop a bill only when it has no household provision. They move after the specific household keywords and the overtime check, into the group Relevance filter follow-ups from the #243 review: NY property tax credit, film credits #250 made for film credits. Corporate and local tax exclusions stay where they were.

    • "Reduces the individual income tax rate and the sales tax rate", "Earned income tax credit; sales and use tax exemption for groceries" and "Earned income tax credit; hemp processing credit" now pass.
    • Pure sales tax, hemp, ACA, corporate rate and local tax bills still drop.
  • Short exclusions match only as whole words or phrases, through a small _has_word helper:

    • aca, matched inside "vacation", "academic" and "vacant";
    • corporate inside "incorporated", dental inside "incidental" and "accidental";
    • city of inside "capacity of", the star inside "the start";
    • school tax inside "preschool tax credit" (adds school taxes so the plural still drops), historic inside "historical";
    • the authority act, commission act and every student act phrases inside "action" and "activity";
    • hemp inside Hempstead, Hemphill and Hempfield.

    Hits that are only other forms of the same word (infertility, municipality, timberland and others) keep matching as before.

Effect

On the 44 existing test_relevance titles plus 39 new ones: 15 bills go from dropped to kept, and none from kept to dropped. Kept to dropped can't happen by design, since a whole-word match only ever matches less than the old substring did. Three of the 15 are side effects, not targets: "city officials", "unincorporated business" and "the taxing authority acts" no longer drop on their own; triage still scores them. All 22 real exclusions in the probe still drop.

Checks

  • pytest scripts/ (without test_compute_impacts_datasets.py): 314 passed (288 on Review follow-ups from #244 and #248–#251 #253).
  • New True cases for the bills that used to drop; each fails on the old code. New False cases that still drop: dental insurance, the City of Buffalo, the STAR program, historic rehabilitation, school taxes, a Housing Authority Act.
  • ruff check on both files: clean.

🤖 Generated with Claude Code

DTrim99 and others added 2 commits December 4, 2026 11:21
…sehold provision

Follow-up from the #250 review (suggestion 2, an issue from before
#250). exclude_keywords ran before relevant_keywords, so realistic
omnibus bills dropped:

- "Relating to taxation", abstract "Reduces the individual income tax
  rate and the sales tax rate." ("sales tax")
- "Earned income tax credit; sales and use tax exemption for groceries"
- "Earned income tax credit; hemp processing credit" ("hemp")
- "Earned income tax credit; vacation pay" ("aca" inside "vacation";
  also "academic" and "vacant")

Following #250's change for film credits, the industry credit keywords
(agricultural, hemp, timber, farmer, clean energy, fuel, ...) and the
sales tax keywords move out of exclude_keywords into lists checked with
the production credits: after the specific household keywords and the
overtime check, before the broad income tax keywords. So they drop a
bill only when it names no household provision; a bill about only the
industry or the sales tax, or with only broad income tax wording, still
drops. Corporate and local tax exclusions stay where they were.

"aca" is matched as a whole word (exclude_words, a regex), so it no
longer matches inside other words; "ACA" bills still drop. The spelled-
out "affordable care act" is not added, since it was not excluded
before.

Each change only turns a dropped bill into a kept one (the whole-word
"aca" matches a subset of what the substring did). Tests add the four
bills above as True, "academic" and "vacant" titles as True, and False
cases for a pure sales tax bill, hemp bills (with and without broad
income tax wording), an ACA credit, a corporate rate cut and a local
income tax bill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same issue as "aca" in "vacation": several exclusions matched inside
other words and dropped valid bills. "the star" (New York's STAR
program) matched "the start of tax year 2027"; "dental" matched
"incidental" and "accidental"; "corporate" matched "incorporates", so a
conformity bill that incorporates the Internal Revenue Code dropped;
"city of" matched "capacity of" and "electricity of".

A scan of every exclusion entry against an English word-frequency list
found the others where a different word contains the entry: "school
tax" in "preschool tax credit", "historic" in "historical", "authority
act", "commission act" and "every student act" in "action" and
"activity", and "hemp" in Hempstead (NY), Hemphill (TX) and Hempfield
(PA). Hits that are forms of the same word (infertility, paramilitary,
municipality, timberland, seafood donation) keep substring matching.

These entries move to exclude_words (late_exclude_words for "hemp", an
industry credit), matched by _has_word as a whole word or phrase: not
preceded or followed by a letter or digit. "school taxes" is listed
next to "school tax", since a whole-phrase match drops plurals.

A whole-word match finds a subset of what the substring did, so a bill
can only go from dropped to kept. A probe over the 44 test_relevance
titles and 39 more found 15 such changes and no kept bill that drops.
All are intended; three are side effects: "city officials",
"unincorporated business" and "the taxing authority acts" no longer
drop by themselves. Tests add 8 True cases that used to drop, and False
cases showing the real exclusions still drop: dental insurance, the City
of Buffalo, the STAR program, historic rehabilitation, school taxes and
a Housing Authority Act (with the corporate rate cut and hemp grower
cases already there).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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