SCBconsulting commited on
Commit
2ceb2ac
·
verified ·
1 Parent(s): 4615658

Update utils/metadata.py

Browse files
Files changed (1) hide show
  1. 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
- ⚖️ Look for 'governed by the laws of XYZ'.
46
  """
47
- match = re.search(r"(?i)governed by the laws of ([\w\s,]+)", text)
48
- return [match.group(1).strip()] if match else []
 
 
 
 
 
 
 
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
- ner_metadata = {
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": [],