Zero-Shot Classification
Transformers
Safetensors
English
qwen3_5
feature-extraction
legal
decision-model
system-one
classification
citator
case-law
custom_code
Instructions to use jonathankleiman/lev with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jonathankleiman/lev with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-classification", model="jonathankleiman/lev", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModel processor = AutoProcessor.from_pretrained("jonathankleiman/lev", trust_remote_code=True) model = AutoModel.from_pretrained("jonathankleiman/lev", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add questions.py
Browse files- questions.py +203 -0
questions.py
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""The four citator questions Lev answers about one (citing decision, cited case) pair.
|
| 2 |
+
|
| 3 |
+
Every system in the benchmark gets these same instructions and option descriptions.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
TREATMENT = {
|
| 7 |
+
"followed": "The court treats the cited case as binding or adopts its rule as the governing rule, and decides the point with it.",
|
| 8 |
+
"applied": "The court applies the cited case's rule or test to the facts before it.",
|
| 9 |
+
"considered": "The court discusses the cited case's reasoning or scope at some length without adopting, distinguishing or rejecting it.",
|
| 10 |
+
"distinguished": "The court says the cited case does not govern because the facts or the law differ.",
|
| 11 |
+
"questioned": "The court doubts or criticises the cited case's correctness or reasoning but does not decline to follow it.",
|
| 12 |
+
"not_followed": "The court declines to follow the cited case.",
|
| 13 |
+
"overruled": "The court, having the power to do so, holds that the cited case was wrongly decided.",
|
| 14 |
+
"superseded_by_statute": "The court says legislation has displaced the rule in the cited case.",
|
| 15 |
+
"referred_to": "The court cites the case in its own reasoning for a point, without more (a 'see' citation, a restated principle, a list of authorities).",
|
| 16 |
+
"inside_quotation": "The case appears only inside a passage that the court quotes from another source.",
|
| 17 |
+
"other_court_or_party": "The case appears only where the court reports the reasoning of another court or the argument of a party, without adopting it.",
|
| 18 |
+
"same_matter": "The cited case is an earlier decision in the same proceeding (the decision under appeal or review, or an earlier ruling between the same parties in this litigation).",
|
| 19 |
+
"not_named": "The excerpt never actually names or cites this case.",
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
# When a decision treats one case in several ways, the label kept is the first of these that applies.
|
| 23 |
+
TREATMENT_PRIORITY = [
|
| 24 |
+
"overruled", "not_followed", "superseded_by_statute", "questioned", "distinguished", "same_matter",
|
| 25 |
+
"followed", "applied", "considered", "referred_to", "other_court_or_party", "inside_quotation", "not_named",
|
| 26 |
+
]
|
| 27 |
+
NEGATIVE = ("overruled", "not_followed", "superseded_by_statute", "questioned")
|
| 28 |
+
|
| 29 |
+
HISTORY = {
|
| 30 |
+
"not_same_matter": "The cited case is not an earlier decision in this same proceeding.",
|
| 31 |
+
"affirmed": "It is the decision under appeal or review, and this decision upholds it.",
|
| 32 |
+
"reversed": "It is the decision under appeal or review, and this decision reverses it.",
|
| 33 |
+
"reversed_in_part": "It is the decision under appeal or review, and this decision reverses part of it.",
|
| 34 |
+
"varied": "It is the decision under appeal or review, and this decision varies it.",
|
| 35 |
+
"set_aside": "It is the decision under appeal or review, and this decision sets it aside.",
|
| 36 |
+
"restored": "It is an earlier decision in this proceeding that this decision restores.",
|
| 37 |
+
"remitted": "It is the decision under appeal or review, and this decision sends the matter back to be decided again.",
|
| 38 |
+
"earlier_ruling": "It is an earlier ruling in this same proceeding that this decision does not decide on.",
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
REPORTED = {
|
| 42 |
+
"none": "The court does not report that anyone else has overruled, reversed, displaced, declined or doubted the cited case.",
|
| 43 |
+
"overruled": "The court reports that another court overruled the cited case.",
|
| 44 |
+
"reversed": "The court reports that the cited case was reversed on appeal.",
|
| 45 |
+
"superseded_by_statute": "The court reports that legislation displaced the cited case.",
|
| 46 |
+
"not_followed": "The court reports that another court declined to follow the cited case.",
|
| 47 |
+
"doubted": "The court reports that another court doubted the cited case.",
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
QUESTIONS = {
|
| 51 |
+
"treatment": {
|
| 52 |
+
"type": "choice",
|
| 53 |
+
"instructions": "How does the citing decision treat the cited case? If it treats the case in more than one way, choose the most negative treatment.",
|
| 54 |
+
"criteria": TREATMENT,
|
| 55 |
+
},
|
| 56 |
+
"history": {
|
| 57 |
+
"type": "choice",
|
| 58 |
+
"instructions": "Is the cited case an earlier decision in the same proceeding as the citing decision, and if so, what does the citing decision do to it?",
|
| 59 |
+
"criteria": HISTORY,
|
| 60 |
+
},
|
| 61 |
+
"reported": {
|
| 62 |
+
"type": "choice",
|
| 63 |
+
"instructions": "Does the citing decision report that another court or legislation (not the citing court itself) has overruled, reversed, displaced, declined to follow or doubted the cited case?",
|
| 64 |
+
"criteria": REPORTED,
|
| 65 |
+
},
|
| 66 |
+
"dissent": {
|
| 67 |
+
"type": "noul",
|
| 68 |
+
"instructions": "Do dissenting reasons in the citing decision cite or treat the cited case?",
|
| 69 |
+
},
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
# ---- Decision-level questions (state: header, front matter, opening and closing paragraphs) ----
|
| 74 |
+
|
| 75 |
+
OUTCOME = {
|
| 76 |
+
"allowed": "An appeal or review is allowed.",
|
| 77 |
+
"allowed_in_part": "An appeal or review is allowed in part.",
|
| 78 |
+
"dismissed": "The appeal, application, motion or claim is dismissed.",
|
| 79 |
+
"granted": "A motion, application or claim is granted.",
|
| 80 |
+
"granted_in_part": "A motion, application or claim is granted in part.",
|
| 81 |
+
"refused": "Leave, bail or another discretionary request is refused.",
|
| 82 |
+
"quashed": "A decision, conviction or order is quashed.",
|
| 83 |
+
"new_trial": "A new trial or new hearing is ordered.",
|
| 84 |
+
"remitted": "The matter is sent back to the decision-maker below.",
|
| 85 |
+
"stayed": "The proceeding or the charge is stayed.",
|
| 86 |
+
"varied": "An order or sentence is varied.",
|
| 87 |
+
"convicted": "The accused is found guilty.",
|
| 88 |
+
"acquitted": "The accused is found not guilty.",
|
| 89 |
+
"sentenced": "A sentence is imposed.",
|
| 90 |
+
"other": "Some other disposition.",
|
| 91 |
+
"none": "The decision makes no disposition.",
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
DECISION_TYPE = {
|
| 95 |
+
"reasons": "Full written reasons for decision.",
|
| 96 |
+
"endorsement": "A short endorsement or brief disposition.",
|
| 97 |
+
"oral_reasons": "Reasons delivered orally.",
|
| 98 |
+
"ruling": "A ruling made during a hearing, for example on a voir dire or an objection.",
|
| 99 |
+
"costs": "Reasons on costs only.",
|
| 100 |
+
"sentencing": "Reasons on sentence only.",
|
| 101 |
+
"leave": "A decision on leave to appeal.",
|
| 102 |
+
"supplementary": "Supplementary or additional reasons.",
|
| 103 |
+
"corrigendum": "A correction to earlier reasons.",
|
| 104 |
+
"other": "None of the above.",
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
PROCEEDING = {
|
| 108 |
+
"appeal": "An appeal to this court.",
|
| 109 |
+
"judicial_review": "Judicial review of an administrative decision.",
|
| 110 |
+
"trial": "A trial or a hearing on the merits in a court.",
|
| 111 |
+
"motion": "A motion.",
|
| 112 |
+
"application": "An application.",
|
| 113 |
+
"sentencing": "A sentencing hearing.",
|
| 114 |
+
"bail": "A bail hearing or bail review.",
|
| 115 |
+
"leave": "An application for leave to appeal.",
|
| 116 |
+
"reference": "A reference.",
|
| 117 |
+
"hearing": "A hearing before a tribunal.",
|
| 118 |
+
"other": "None of the above.",
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
AREAS = [
|
| 122 |
+
"Aboriginal and Indigenous Law",
|
| 123 |
+
"Access to Information and Privacy",
|
| 124 |
+
"Administrative Law",
|
| 125 |
+
"Arbitration and Dispute Resolution",
|
| 126 |
+
"Bankruptcy and Insolvency",
|
| 127 |
+
"Citizenship, Immigration and Refugee Law",
|
| 128 |
+
"Civil Procedure",
|
| 129 |
+
"Commercial Law",
|
| 130 |
+
"Competition, Trade and Customs",
|
| 131 |
+
"Conflict of Laws",
|
| 132 |
+
"Constitutional Law",
|
| 133 |
+
"Construction Law",
|
| 134 |
+
"Contracts",
|
| 135 |
+
"Corporations and Business Associations",
|
| 136 |
+
"Criminal Law",
|
| 137 |
+
"Criminal Procedure",
|
| 138 |
+
"Damages and Remedies",
|
| 139 |
+
"Education Law",
|
| 140 |
+
"Elections and Democratic Institutions",
|
| 141 |
+
"Employment Law",
|
| 142 |
+
"Labour Relations",
|
| 143 |
+
"Workers' Compensation and Workplace Safety",
|
| 144 |
+
"Environmental Law",
|
| 145 |
+
"Estates and Trusts",
|
| 146 |
+
"Evidence",
|
| 147 |
+
"Family Law",
|
| 148 |
+
"Health Law",
|
| 149 |
+
"Mental Health, Capacity and Guardianship",
|
| 150 |
+
"Human Rights",
|
| 151 |
+
"Insurance",
|
| 152 |
+
"Intellectual Property",
|
| 153 |
+
"International Law",
|
| 154 |
+
"Maritime Law",
|
| 155 |
+
"Military Law",
|
| 156 |
+
"Motor Vehicles and Highway Traffic",
|
| 157 |
+
"Municipal and Planning Law",
|
| 158 |
+
"Natural Resources, Energy and Agriculture",
|
| 159 |
+
"Professions and Occupations",
|
| 160 |
+
"Real Property",
|
| 161 |
+
"Residential Tenancies",
|
| 162 |
+
"Restitution and Equity",
|
| 163 |
+
"Securities and Financial Services",
|
| 164 |
+
"Sentencing",
|
| 165 |
+
"Social Benefits",
|
| 166 |
+
"Statutory Interpretation",
|
| 167 |
+
"Taxation",
|
| 168 |
+
"Torts",
|
| 169 |
+
"Transportation and Communications",
|
| 170 |
+
"Youth Criminal Justice"
|
| 171 |
+
]
|
| 172 |
+
|
| 173 |
+
STANDARD_OF_REVIEW = {
|
| 174 |
+
"correctness": "The court applies the correctness standard to this issue.",
|
| 175 |
+
"reasonableness": "The court applies the reasonableness standard to this issue.",
|
| 176 |
+
"palpable_and_overriding_error": "The court applies the palpable and overriding error standard to this issue.",
|
| 177 |
+
"patent_unreasonableness": "The court applies the patent unreasonableness standard to this issue.",
|
| 178 |
+
"other": "The court states some other standard of review for this issue.",
|
| 179 |
+
"not_stated": "The excerpt states no standard of review for this issue.",
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
ELEMENT = {
|
| 183 |
+
"met": "The court finds that the condition this element states is satisfied on the facts.",
|
| 184 |
+
"not_met": "The court finds that the condition this element states is not satisfied.",
|
| 185 |
+
"not_decided": "The court does not decide this element.",
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
QUESTIONS.update({
|
| 189 |
+
"outcome": {"type": "choice", "instructions": "What is the disposition in this decision?", "criteria": OUTCOME},
|
| 190 |
+
"decision_type": {"type": "choice", "instructions": "What kind of document is this decision?", "criteria": DECISION_TYPE},
|
| 191 |
+
"proceeding": {"type": "choice", "instructions": "What kind of proceeding does this decision decide?", "criteria": PROCEEDING},
|
| 192 |
+
"area": {"type": "choice", "instructions": "What is the area of law of the main issue this decision decides? For an appeal, choose the area of the dispute under appeal.",
|
| 193 |
+
"criteria": {a: None for a in AREAS}},
|
| 194 |
+
"publication_ban": {"type": "noul", "instructions": "Does the decision state that a publication ban, a sealing order or statutory anonymisation applies?"},
|
| 195 |
+
"self_represented": {"type": "noul", "instructions": "Does the decision say that a party was self-represented or appeared in person?"},
|
| 196 |
+
"separate_opinions": {"type": "noul", "instructions": "Does the decision include separate concurring or dissenting reasons?"},
|
| 197 |
+
"standard_of_review": {"type": "choice", "instructions": "Which standard of review does the court apply to the issue stated in the excerpt?", "criteria": STANDARD_OF_REVIEW},
|
| 198 |
+
"element_finding": {"type": "choice", "instructions": "What does the court find on the element of the legal test stated in the excerpt?", "criteria": ELEMENT},
|
| 199 |
+
})
|
| 200 |
+
|
| 201 |
+
CITATOR = ("treatment", "history", "reported", "dissent")
|
| 202 |
+
DECISION_LEVEL = ("outcome", "decision_type", "proceeding", "area", "publication_ban", "self_represented", "separate_opinions")
|
| 203 |
+
PASSAGE_LEVEL = ("standard_of_review", "element_finding")
|