Update app.py
Browse files
app.py
CHANGED
@@ -70,35 +70,15 @@ class ContractAnalyzer:
|
|
70 |
if end_idx != -1:
|
71 |
info["parties"].append(text[start_idx:end_idx].strip())
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
"اتفق الطرفان على", "حيث أن", "حيث إن", "تمهيد",
|
77 |
-
"بشأن", "لغرض", "عقد"
|
78 |
-
]
|
79 |
-
|
80 |
-
for indicator in subject_indicators:
|
81 |
-
if indicator in text:
|
82 |
-
start_idx = text.find(indicator)
|
83 |
-
# البحث عن نهاية الجملة
|
84 |
-
end_idx = text.find(".", start_idx)
|
85 |
-
if end_idx == -1:
|
86 |
-
end_idx = text.find("\n", start_idx)
|
87 |
-
if end_idx != -1:
|
88 |
-
subject_text = text[start_idx:end_idx].strip()
|
89 |
-
# تجنب النصوص القصيرة جداً
|
90 |
-
if len(subject_text) > 10:
|
91 |
-
info["subject"] = subject_text
|
92 |
-
break
|
93 |
-
|
94 |
-
# محاولة ثانية للعثور على الموضوع إذا لم يتم العثور عليه
|
95 |
-
## if info["subject"] == "غير محدد":
|
96 |
# البحث في الجمل الأولى من العقد
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
|
103 |
return info
|
104 |
|
|
|
70 |
if end_idx != -1:
|
71 |
info["parties"].append(text[start_idx:end_idx].strip())
|
72 |
|
73 |
+
|
74 |
+
# محاولة للعثور على الموضوع
|
75 |
+
if info["subject"] == "غير محدد":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
# البحث في الجمل الأولى من العقد
|
77 |
+
first_sentences = text.split('.')[:3] # أول ثلاث جمل
|
78 |
+
for sentence in first_sentences:
|
79 |
+
if any(word in sentence.lower() for word in ["اتفاق", "عقد", "تعاقد"]):
|
80 |
+
info["subject"] = sentence.strip()
|
81 |
+
break
|
82 |
|
83 |
return info
|
84 |
|