import re from utils.actions import Rule, BaseCategorizer rules = ( Rule([r"Amendment (?P<bills>.+?) -\s+Laid On Table"], ["amendment-deferral"]), Rule(["Favorable"], ["committee-passage-favorable"]), Rule(["(?i)Amendment (?P<bills>.+?) defeated"], ["amendment-failure"]), Rule(["(?i)introduced and adopted in lieu of (?P<bills>.+)"], ["introduction"]), Rule( ["(?i)assigned to (?P<committees>.+?) Committee in"], ["referral-committee", "introduction"], ), Rule(["Signed by Governor"], ["executive-signature"]), Rule([r"(?i)Amendment (?P<bills>[\w\s]+?) Introduced"], ["amendment-introduction"]), Rule(["Amendment (?P<bills>.+?) - Passed"], ["amendment-passage"]), Rule(["(?i)^Passed by"], ["passage"]), Rule(["^Defeated"], ["failure"]), Rule(["(?i)unfavorable"], ["committee-passage-unfavorable"]), Rule([r"Reported Out of Committee \((?P<committees>.+?)\)"], ["committee-passage"]), Rule(["Vetoed by Governor"], ["executive-veto"]), Rule([r"(?i)Amendment (?P<bills>.+?)\s+-\s+Introduced"], ["amendment-introduction"]), Rule([r"(?i)Amendment (?P<bills>[\w\s]+?) Passed"], ["amendment-passage"]), Rule( [ r"Amendment (?P<bills>.+?) - Defeated by House of .+?\. Votes: Defeated" ],
# u'NRMW': '', u'PSEP': u'Public Safety & Emergency Preparedness', u'SGTA': u'State Government & Tribal Affairs', u'TEC': u'Technology, Energy & Communications', u'TR': u'Transportation', u'TRAN': u'Transportation', u'WAYS': u'Ways & Means' } committee_names = committees_abbrs.values() committees_rgx = '(%s)' % '|'.join( sorted(committee_names, key=len, reverse=True)) # These are regex patterns that map to action categories. _categorizer_rules = ( Rule(r'yeas, (?P<yes_votes>\d+); nays, (?P<no_votes>\d+); ' r'absent, (?P<absent_voters>\d+); excused, (?P<excused_voters>\d+)'), Rule(r'Committee on (?P<committees>.+?) at \d'), Rule(r'(?P<committees>.+?) relieved of further'), Rule(r'Passed to (?P<committees>.+?) for \S+ reading'), Rule(r'by (?P<committees>.+?) Committee'), Rule(r'^Adopted', 'passage'), Rule(r'^Introduced', 'introduction'), Rule(r'Third reading, adopted', ['reading-3', 'passage']), Rule(r'Prefiled for introduction', 'filing'), Rule(r'amendment adopted', 'amendment-passage'), Rule(r'amendment not adopted', 'amendment-failure'), Rule(r"(?i)third reading, (?P<pass_fail>(passed|failed))", 'reading-3'), Rule(r'Read first time', 'reading-1'), Rule(r"(?i)first reading, referred to (?P<committees>.*)\.", 'reading-1'), Rule(r"(?i)And refer to (?P<committees>.*)", 'referral-committee'),
from utils.actions import Rule, BaseCategorizer # These are regex patterns that map to action categories. _categorizer_rules = ( Rule((r"\(Ayes (?P<yes_votes>\d+)\.\s+Noes\s+" r"(?P<no_votes>\d+)\.( Page \S+\.)?\)")), Rule(r"^Introduced", "introduction"), Rule(r"(?i)Referred to (?P<committees>.+)", "referral-committee"), Rule(r"(?i)Referred to (?P<committees>.+?)(\.\s+suspense)", "referral-committee"), Rule(r"re-refer to Standing (?P<committees>[^.]+)\.", "referral-committee"), Rule(r"Read first time\.", "reading-1"), Rule(r"Read second time and amended", ["reading-2"]), Rule(r"Read third time", "reading-3"), Rule(r"Read third time. Refused passage\.", "failure"), Rule( [r"(?i)read third time.{,5}passed", r"(?i)Read third time.+?Passed"], ["passage", "reading-3"], ), Rule(r"Approved by the Governor", "executive-signature"), Rule(r"Approved by the Governor with item veto", "executive-veto-line-item"), Rule(r"Chaptered by Secretary of State", "became-law"), Rule("Vetoed by Governor", "executive-veto"), Rule("Vetoed by the Governor", "executive-veto"), Rule(r"To Governor", "executive-receipt"), Rule(r"amendments concurred in", "amendment-passage"), Rule(r"refused to concur in Assembly amendments", "amendment-failure"), Rule(r"Failed passage in committee", "committee-failure"), Rule(
u"Senior Citizen Issues", u"Special Investigations", u"Technology", u"Veterans Affairs", u"Veterans Affairs/ Homeland Security", u"Water Resources", u"Workforce Investment for Economic Development", ] committees_rgx = "(%s)" % "|".join(sorted(committees, key=len, reverse=True)) rules = ( Rule( ["Communicated to Senate", "Senate received", "Ordered to Senate"], actor="upper", ), Rule( ["Communicated to House", "House received", "Ordered to House"], actor="lower" ), Rule("Read 1st time", "reading-1"), Rule("Read 2nd time", "reading-2"), Rule("Read 3rd time", "reading-3"), Rule("Filed for introduction", "filing"), Rule("^Introduced in", "introduction"), Rule(["Passed Senate", "Passed House"], "passage"), Rule(["Reported do pass", "With amendment, do pass"], "committee-passage"), Rule( [ ", but first to .+?; then (?P<committees>[^;]+)", "To (?P<committees>.+?) then",
from utils.actions import Rule, BaseCategorizer # These are regex patterns that map to action categories. _categorizer_rules = ( Rule( ["Amendment #\\S+ \\((?P<legislator>.+?)\\) bundle YES adopted"], ["amendment-passage"], ), Rule(["(?i)Signed by (the )Governor(.*)"], ["executive-signature"]), Rule(["Accompanied (by )?(?P<bill_id>[SH]\\S+)"], []), Rule(["Discharged to the committee on (?P<committees>.+)"], ["referral-committee"]), Rule(["(?i)Amendment #\\d+ adopted"], ["amendment-passage"]), Rule( [ "Amendment #\\d+ \\((?P<legislator>.+?)\\) rejected", "(?i)amendment.+?rejected", ], ["amendment-failure"], ), Rule(["(?is)Amendment \\S+ withdrawn"], ["amendment-withdrawal"]), Rule( ["Amendment #\\S+ \\((?P<legislator>.+?)\\) Pending"], ["amendment-introduction"], ), Rule(["(?P<bill>[HS]\\d+)"], []), Rule(["(?i)Amendment \\(#\\d+\\) adopted"], ["amendment-passage"]), Rule(["(?i)with veto"], ["executive-veto"]), Rule(["reported favorably by committee"], ["committee-passage-favorable"]), Rule(["Accompan\\S+ .+?(?P<bill_id>[SH]\\S+)"], []), Rule(["(?i)Amendment \\d+ pending"], ["amendment-deferral"]), Rule(["Read,"], ["reading-1"]),
Rule([ # Add a bajilion links to entities. r"SCs (changed|removed) (?P<legislators>.+)", r"Conference Committee on (?P<committees>.+)", r"Conference granted, naming:?\s+Conference Committee on (?P<committees>.+)", r"vote by Representative(?P<legislators>.+)", r"amended (?P<committees>.+?) committee", r"coauthored by (?P<legislators>.+)", (r"Remove Senator .+? as principal Senate author " r"and substitute with Senator (?P<legislators>.+?)"), r"(?i)committee substitute (?P<committees>.+)", r"(?i)remove\s{,10}as\s{,10}author\s{,10}(?P<legislators>.+);", r"(?i)SCs\s{,10}named\s{,10}(?P<legislators>.+)", (r"Pending removal author Senator (?P<legislators>.+?) " r"and replace with Senator"), r"(?i)Representative\(s\)\s{,10}(?P<legislators>.+)", r"Withdrawn from Calendar; (?P<committees>.+)", (r"Pending removal author Senator .+? and replace " r"with Senator (?P<legislators>.+)"), r"Ayes:\s+(?P<yes_votes>\d+)\s+Nays:\s+(?P<no_votes>\d+)", (r"remove as principal author Representative .+? and substitute " r"with Representative (?P<legislators>.+?)"), r"Pending coauthorship Senator\(s\) (?P<legislators>.+)", (r"Remove Representative (?P<legislators>.+?) as principal " r"House author and substitute with Representative"), r"Pending removal principal author Representative .+? and " r"replace with Representative (?P<legislators>.+)", r"(?i)(co)?authored\s{,10}by\s{,10}(?P<legislators>.+)", r"Second Reading referred to (?P<committees>.+? Committee)", r"Notice served to reconsider vote on measure (?P<legislators>.+)", (r"Pending removal principal author Representative (?P<legislators>.+) " r"and replace with Representative .+"), (r"remove as principal author Representative (?P<legislators>.+?) " r"and substitute with Representative"), r"CR; Do Pass(, as amended,|, amended by)? (?P<committees>.+)", r"coauthor (Senator|Representative) (?P<legislators>.+)", r"Ayes:\s+(?P<yes_votes>\d+)\s+Nays:\s+(?P<no_votes>\d+)", ]),
u"Executive Committee of Legislative Council", u"Transportation", u"Health (?:and|&) Human Services", u"Education", u"Legislative Council", u"Legal Services", u"Capital Development", u"Transportation (?:and|&) Energy", u"Joint Budget Committee", u"Business, Labor, (?:and|&) Technology", u"State, Veterans, (?:and|&) Military Affairs", ] rules = ( Rule("^House", actor="lower"), Rule("^Senate", actor="upper"), Rule("^Introduced in Senate", actor="upper"), Rule("^Introduced in House", actor="lower"), Rule("^Governor", actor="executive"), Rule("Governor Action - Partial Veto", "executive-veto-line-item"), Rule("Sent to the Governor", "executive-receipt"), Rule("Governor Action - Signed", "executive-signature"), Rule("Governor Signed", "executive-signature"), Rule("Governor Action - Vetoed", "executive-veto"), Rule(r"^Introduced", "introduction"), Rule(r"Assigned to (?P<committees>.+)"), Rule("(?i)refer (un)?amended to (?P<committees>.+)", ["referral-committee"]), Rule(r"(?i)\S+ Committee on (?P<committees>.+?) Refer (un)amended"), Rule("Assigned to (<?P<committees>.+?)", "referral-committee"), Rule("Second Reading Passed", [u"reading-2"]),
import re from utils.actions import Rule, BaseCategorizer rules = ( Rule([ (r"(?P<yes_votes>\d+) Yeas - (?P<no_votes>\d+) " r"Nays- (?P<excused>\d+) Excused - (?P<absent>\d+) Absent"), (r"(?P<yes_votes>\d+) -Yeas, (?P<no_votes>\d+) -Nays, " r"(?P<excused>\d+) -Excused, (?P<absent>\d+) -Absent"), r"(?P<committees>Committee on .+?) suggested and ordered printed", (r"\(Yeas (?P<yes_votes>\d+) - Nays (?P<no_votes>\d+) - Absent " r"(?P<absent>\d+) - Excused (?P<excused>\d+)\)( \(Vacancy " r"(?P<vacant>\d+)\))?"), ]), Rule([ r"Representative (?P<legislators>.+?) of \S+", r"Senator (?P<legislators>.+?of \S+)", r"Representative (?P<legislators>[A-Z]+?( of [A-Za-z]+))", r"Senator (?P<legislators>\S+ of \S+)", r"Representative [A-Z ]+? of \S+", ]), Rule( "REFERRED to the (?P<committees>Committee on [A-Z ]+(?![a-z]))", "referral-committee", ), Rule(["READ A SECOND TIME"], ["reading-2"]), Rule(["(?i)read once"], ["reading-1"]), Rule("(?i)finally passed", "passage"), Rule("(?i)passed to be enacted", "passage"), Rule(r"COMMITTED to the (?P<committees>Committee on .+?)\.", "referral-committee"),