sid570 commited on
Commit
141397e
·
verified ·
1 Parent(s): 1aa5ff8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -139,6 +139,9 @@ def detect_entities(text):
139
  # ============================================================
140
  # 🎭 MASKING (NLLB-SAFE PLACEHOLDERS)
141
  # ============================================================
 
 
 
142
  def detect_and_mask(text):
143
  detected = detect_entities(text)
144
 
@@ -148,10 +151,10 @@ def detect_and_mask(text):
148
 
149
  masked = text
150
  entity_map = {}
151
- global_counter = 1 # 🔑 single global counter (NLLB-safe)
152
 
153
  for e in detected:
154
- placeholder = f"@@@{global_counter}@@@"
155
  global_counter += 1
156
 
157
  masked = re.sub(
@@ -168,6 +171,7 @@ def detect_and_mask(text):
168
  "entities": detected
169
  }
170
 
 
171
  # ============================================================
172
  # 🔓 UNMASKING
173
  # ============================================================
 
139
  # ============================================================
140
  # 🎭 MASKING (NLLB-SAFE PLACEHOLDERS)
141
  # ============================================================
142
+ # ============================================================
143
+ # 🎭 MASKING (NLLB-SAFE PLACEHOLDERS — FINAL)
144
+ # ============================================================
145
  def detect_and_mask(text):
146
  detected = detect_entities(text)
147
 
 
151
 
152
  masked = text
153
  entity_map = {}
154
+ global_counter = 1
155
 
156
  for e in detected:
157
+ placeholder = f"\uFFF0{global_counter}\uFFF1"
158
  global_counter += 1
159
 
160
  masked = re.sub(
 
171
  "entities": detected
172
  }
173
 
174
+
175
  # ============================================================
176
  # 🔓 UNMASKING
177
  # ============================================================