Spaces:
Running
Running
Update updated_word.py
Browse files- updated_word.py +11 -0
updated_word.py
CHANGED
|
@@ -961,6 +961,17 @@ def process_tables(document, flat_json):
|
|
| 961 |
for row in table.rows[:3]:
|
| 962 |
for cell in row.cells:
|
| 963 |
table_text += get_clean_text(cell).lower() + " "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 964 |
|
| 965 |
# Enhanced vehicle registration detection
|
| 966 |
vehicle_indicators = ["registration number", "sub-contractor", "weight verification", "rfs suspension"]
|
|
|
|
| 961 |
for row in table.rows[:3]:
|
| 962 |
for cell in row.cells:
|
| 963 |
table_text += get_clean_text(cell).lower() + " "
|
| 964 |
+
|
| 965 |
+
# 🎯 NEW: Detect Management Summary tables (with DETAILS column)
|
| 966 |
+
management_summary_indicators = ["mass management", "maintenance management", "fatigue management"]
|
| 967 |
+
has_management = any(indicator in table_text for indicator in management_summary_indicators)
|
| 968 |
+
has_details = "details" in table_text
|
| 969 |
+
|
| 970 |
+
if has_management and has_details:
|
| 971 |
+
print(f" 📋 Detected Management Summary table")
|
| 972 |
+
summary_replacements = handle_management_summary_table(table, flat_json)
|
| 973 |
+
replacements_made += summary_replacements
|
| 974 |
+
continue
|
| 975 |
|
| 976 |
# Enhanced vehicle registration detection
|
| 977 |
vehicle_indicators = ["registration number", "sub-contractor", "weight verification", "rfs suspension"]
|