Spaces:
Sleeping
Sleeping
fix(v4.3.1): redlining.py — Run 4 delta fixes (A-E)
Browse files- redlining.py +18 -3
redlining.py
CHANGED
|
@@ -435,13 +435,28 @@ _LABEL_KEYWORDS = {
|
|
| 435 |
"Contract by using": ["by using", "continued use", "acceptance"],
|
| 436 |
}
|
| 437 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 438 |
|
| 439 |
def _validate_clause_match(label, clause_text):
|
| 440 |
-
"""FIX v4.3: Validate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
keywords = _LABEL_KEYWORDS.get(label, [])
|
| 442 |
if not keywords:
|
| 443 |
-
return True
|
| 444 |
-
text_lower = clause_text.lower()
|
| 445 |
return any(kw in text_lower for kw in keywords)
|
| 446 |
|
| 447 |
|
|
|
|
| 435 |
"Contract by using": ["by using", "continued use", "acceptance"],
|
| 436 |
}
|
| 437 |
|
| 438 |
+
# FIX v4.3.1: Exclusion keywords — if ANY of these appear, the clause is rejected for this label.
|
| 439 |
+
# Catches chunks that span two sections (e.g., §12.5 Waiver + §12.6 Non-Solicitation merged into one chunk).
|
| 440 |
+
_LABEL_EXCLUDE_KEYWORDS = {
|
| 441 |
+
"No-Solicit of Employees": ["waiver of", "waive any", "waives the right", "failure to enforce"],
|
| 442 |
+
"No-Solicit of Customers": ["waiver of", "waive any", "waives the right", "failure to enforce"],
|
| 443 |
+
"Non-Disparagement": ["arbitrat", "aaa", "jams", "class action", "waives any right to participate"],
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
|
| 447 |
def _validate_clause_match(label, clause_text):
|
| 448 |
+
"""FIX v4.3.1: Validate clause matches label — checks BOTH required AND excluded keywords."""
|
| 449 |
+
text_lower = clause_text.lower()
|
| 450 |
+
|
| 451 |
+
# Check exclusions first — hard reject
|
| 452 |
+
exclusions = _LABEL_EXCLUDE_KEYWORDS.get(label, [])
|
| 453 |
+
if exclusions and any(kw in text_lower for kw in exclusions):
|
| 454 |
+
return False
|
| 455 |
+
|
| 456 |
+
# Check required keywords
|
| 457 |
keywords = _LABEL_KEYWORDS.get(label, [])
|
| 458 |
if not keywords:
|
| 459 |
+
return True
|
|
|
|
| 460 |
return any(kw in text_lower for kw in keywords)
|
| 461 |
|
| 462 |
|