Repository navigation
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Short exclusions match only as whole words or phrases, through a small
_has_wordhelper:aca, matched inside "vacation", "academic" and "vacant";corporateinside "incorporated",dentalinside "incidental" and "accidental";city ofinside "capacity of",the starinside "the start";school taxinside "preschool tax credit" (addsschool taxesso the plural still drops),historicinside "historical";authority act,commission actandevery student actphrases inside "action" and "activity";hempinside 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_relevancetitles 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/(withouttest_compute_impacts_datasets.py): 314 passed (288 on Review follow-ups from #244 and #248–#251 #253).ruff checkon both files: clean.🤖 Generated with Claude Code