Spaces:
Running
Running
Update utils/metadata.py
Browse files- utils/metadata.py +11 -4
utils/metadata.py
CHANGED
@@ -42,10 +42,17 @@ def extract_parties(text):
|
|
42 |
|
43 |
def extract_governing_law(text):
|
44 |
"""
|
45 |
-
⚖️
|
46 |
"""
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
def extract_venue(text):
|
51 |
"""
|
@@ -68,7 +75,7 @@ def extract_metadata(text):
|
|
68 |
words = text.split()
|
69 |
chunks = [" ".join(words[i:i + max_chunk_length]) for i in range(0, len(words), max_chunk_length)]
|
70 |
|
71 |
-
|
72 |
"EFFECTIVE_DATE": [],
|
73 |
"PARTIES": [],
|
74 |
"GOVERNING_LAW": [],
|
|
|
42 |
|
43 |
def extract_governing_law(text):
|
44 |
"""
|
45 |
+
⚖️ Capture governing law even if it's stated less directly.
|
46 |
"""
|
47 |
+
patterns = [
|
48 |
+
r"(?i)governed by the laws of ([\w\s,]+)",
|
49 |
+
r"(?i)under the laws of ([\w\s,]+)"
|
50 |
+
]
|
51 |
+
for pattern in patterns:
|
52 |
+
match = re.search(pattern, text)
|
53 |
+
if match:
|
54 |
+
return [match.group(1).strip()]
|
55 |
+
return []
|
56 |
|
57 |
def extract_venue(text):
|
58 |
"""
|
|
|
75 |
words = text.split()
|
76 |
chunks = [" ".join(words[i:i + max_chunk_length]) for i in range(0, len(words), max_chunk_length)]
|
77 |
|
78 |
+
ner_metadata = {
|
79 |
"EFFECTIVE_DATE": [],
|
80 |
"PARTIES": [],
|
81 |
"GOVERNING_LAW": [],
|