Spaces:
Sleeping
Sleeping
Update server.py
Browse files
server.py
CHANGED
|
@@ -98,23 +98,30 @@ def expand_query(query: str) -> List[str]:
|
|
| 98 |
def simplify_schematic_text(text: str) -> str:
|
| 99 |
# 1. ניקוי שמות רכיבים טכניים מה-DB החדש
|
| 100 |
text = text.replace("ESP32-DEVKITC-32D_ESP32-DEVKITC-30GPIO", "בקר ESP32")
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
text = text.replace("0201080606", "")
|
| 105 |
text = text.replace("040709_0804060105", "")
|
| 106 |
|
| 107 |
-
# 2.
|
| 108 |
-
text = text.replace("
|
| 109 |
-
text = text.replace("HMI
|
| 110 |
-
text = text.replace("HMI", "המסך")
|
| 111 |
-
text = text.replace("NEXTION", "המסך")
|
| 112 |
|
| 113 |
-
# 3.
|
| 114 |
-
text = text.replace("()", "") #
|
| 115 |
-
text = text.replace(" ", " ") #
|
| 116 |
|
| 117 |
-
# 4.
|
| 118 |
text = text.replace("connects to", "מחובר אל")
|
| 119 |
text = text.replace("Pin", "פין")
|
| 120 |
|
|
|
|
| 98 |
def simplify_schematic_text(text: str) -> str:
|
| 99 |
# 1. ניקוי שמות רכיבים טכניים מה-DB החדש
|
| 100 |
text = text.replace("ESP32-DEVKITC-32D_ESP32-DEVKITC-30GPIO", "בקר ESP32")
|
| 101 |
+
|
| 102 |
+
# Specific component mappings based on your schematic
|
| 103 |
+
# We map the ID to a readable name but KEEP the ID for reference
|
| 104 |
+
text = re.sub(r"U2\b", "ESP32 (U2)", text)
|
| 105 |
+
text = re.sub(r"U4\b", "Level Shifter (U4)", text)
|
| 106 |
+
text = re.sub(r"U3\b", "Main Board (U3)", text)
|
| 107 |
+
text = re.sub(r"LCD1\b", "Nextion Screen (LCD1)", text)
|
| 108 |
+
|
| 109 |
+
# Clean up the raw database strings if they still exist
|
| 110 |
+
text = text.replace("LevelConvertor (BOB_19002)", "Level Shifter (U4)")
|
| 111 |
+
text = text.replace("BOB_19002", "")
|
| 112 |
+
text = text.replace("StudentBoard (0201080606)", "Main Board (U3)")
|
| 113 |
text = text.replace("0201080606", "")
|
| 114 |
text = text.replace("040709_0804060105", "")
|
| 115 |
|
| 116 |
+
# 2. Clean Generic names
|
| 117 |
+
text = text.replace("(NEXTION)", "")
|
| 118 |
+
text = text.replace("HMI", "")
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
# 3. Clean up syntax
|
| 121 |
+
text = text.replace("()", "") # Remove empty brackets
|
| 122 |
+
text = text.replace(" ", " ") # Remove double spaces
|
| 123 |
|
| 124 |
+
# 4. Translate verbs for the Hebrew sentence structure
|
| 125 |
text = text.replace("connects to", "מחובר אל")
|
| 126 |
text = text.replace("Pin", "פין")
|
| 127 |
|