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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
WEEKDAY_MAP = {
|
| 6 |
# Bhojpuri → Kreol
|
| 7 |
"somvar": "lindi",
|
| 8 |
"lendi": "lindi",
|
| 9 |
-
|
| 10 |
"mangal": "mardi",
|
| 11 |
"mangar": "mardi",
|
| 12 |
-
|
| 13 |
"budh": "merkredi",
|
| 14 |
-
|
| 15 |
"guruwar": "zedi",
|
| 16 |
-
|
| 17 |
"sukar": "vandredi",
|
| 18 |
"sukrawar": "vandredi",
|
| 19 |
-
|
| 20 |
"sani": "samdi",
|
| 21 |
"samdi": "samdi",
|
| 22 |
-
|
| 23 |
"raviwaar": "dimans",
|
| 24 |
|
| 25 |
# Kreol → Bhojpuri
|
|
@@ -31,3 +200,43 @@ WEEKDAY_MAP = {
|
|
| 31 |
"samdi": "sani",
|
| 32 |
"dimans": "raviwaar"
|
| 33 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ============================================================
|
| 2 |
+
# ENTITY DICTIONARY
|
| 3 |
+
# Used by entity masking API
|
| 4 |
+
# ============================================================
|
| 5 |
+
|
| 6 |
+
ENTITY_DICTIONARY = {
|
| 7 |
+
|
| 8 |
+
# ========================
|
| 9 |
+
# 1. DISTRICTS OF MAURITIUS
|
| 10 |
+
# ========================
|
| 11 |
+
"DISTRICT": [
|
| 12 |
+
"Port Louis", "Pamplemousses", "Riviere du Rempart",
|
| 13 |
+
"Flacq", "Grand Port", "Savanne", "Moka",
|
| 14 |
+
"Plaines Wilhems", "Riviere Noire", "Black River"
|
| 15 |
+
],
|
| 16 |
+
|
| 17 |
+
# ========================
|
| 18 |
+
# 2. CITIES
|
| 19 |
+
# ========================
|
| 20 |
+
"CITY": [
|
| 21 |
+
"Curepipe", "Vacoas", "Quatre Bornes",
|
| 22 |
+
"Beau Bassin", "Rose Hill", "Ebene", "Phoenix",
|
| 23 |
+
"Goodlands", "Grand Baie", "Mahebourg", "Flic en Flac",
|
| 24 |
+
"Tamarin", "Bel Air", "Roche Bois",
|
| 25 |
+
"Piton", "Triolet"
|
| 26 |
+
],
|
| 27 |
+
|
| 28 |
+
# ========================
|
| 29 |
+
# 3. VILLAGES
|
| 30 |
+
# ========================
|
| 31 |
+
"VILLAGE": [
|
| 32 |
+
"Albion", "Amaury", "Amitie-Gokhoola", "Arsenal",
|
| 33 |
+
"Baie du Tombeau", "Baie du Cap", "Bambous",
|
| 34 |
+
"Bambous Virieux", "Bananes", "Beau Vallon",
|
| 35 |
+
"Bel Air Riviere Seche", "Bel Ombre", "Belle Vue Maurel",
|
| 36 |
+
"Benares", "Bois Cheri", "Bois des Amourettes",
|
| 37 |
+
"Bon Accueil", "Bramsthan", "Brisee Verdiere",
|
| 38 |
+
"Britannia", "Calebasses", "Camp Carol",
|
| 39 |
+
"Camp de Masque", "Camp de Masque Pave", "Camp Diable",
|
| 40 |
+
"Camp Ithier", "Camp Thorel", "Cap Malheureux",
|
| 41 |
+
"Cascavelle", "Case Noyale", "Centre de Flacq",
|
| 42 |
+
"Chamarel", "Chamouny", "Chemin Grenier",
|
| 43 |
+
"Clemencia", "Cluny", "Congomah", "Cottage",
|
| 44 |
+
"Creve Coeur", "D'Epinay", "Dagotier", "Dubreuil",
|
| 45 |
+
"Ecroignard", "Esperance", "Esperance Trebuchet",
|
| 46 |
+
"Fond du Sac", "Grand Bel Air", "Grand Bois",
|
| 47 |
+
"Grand Gaube", "Grand River South East",
|
| 48 |
+
"Grand Sable", "Grande Retraite",
|
| 49 |
+
"Grande Riviere Noire", "Gros Cailloux",
|
| 50 |
+
"L'Avenir", "L'Escalier", "La Flora", "La Gaulette",
|
| 51 |
+
"La Laura-Malenga", "Lallmatie", "Laventure",
|
| 52 |
+
"Le Hochet", "Le Morne", "Long Mountain",
|
| 53 |
+
"Mapou", "Mare d'Albert", "Mare La Chaux",
|
| 54 |
+
"Mare Tabac", "Medine", "Melrose", "Midlands",
|
| 55 |
+
"Montagne Blanche", "Morcellement St. Andre",
|
| 56 |
+
"New Grove", "Notre Dame", "Nouvelle Decouverte",
|
| 57 |
+
"Nouvelle France", "Old Grand Port", "Olivia",
|
| 58 |
+
"Petit Bel Air", "Petit Raffray",
|
| 59 |
+
"Plaine des Papayes", "Plaine des Roches",
|
| 60 |
+
"Plaine Magnien", "Pointe aux Piments",
|
| 61 |
+
"Poste de Flacq", "Poudre d'Or",
|
| 62 |
+
"Poudre d'Or Hamlet", "Providence",
|
| 63 |
+
"Quartier Militaire", "Quatre Cocos",
|
| 64 |
+
"Quatre Soeurs", "Queen Victoria", "Richelieu",
|
| 65 |
+
"Ripailles", "Riviere des Anguilles",
|
| 66 |
+
"Riviere des Creoles", "Riviere du Poste",
|
| 67 |
+
"Roches Noires", "Roche Terre", "Rose Belle",
|
| 68 |
+
"Sebastopol", "Seizieme Mille", "Souillac",
|
| 69 |
+
"St Aubin", "St Hubert", "St Julien",
|
| 70 |
+
"St Julien D'Hotman", "St Pierre", "Surinam",
|
| 71 |
+
"Terre Rouge", "The Vale", "Trois Boutiques",
|
| 72 |
+
"Trou aux Biches", "Trou d'Eau Douce",
|
| 73 |
+
"Tyack", "Union Park", "Verdun", "Ville Bague"
|
| 74 |
+
],
|
| 75 |
+
|
| 76 |
+
# ========================
|
| 77 |
+
# 4. LANDMARKS & REGIONS
|
| 78 |
+
# ========================
|
| 79 |
+
"LANDMARK": [
|
| 80 |
+
"Bagatelle", "Caudan Waterfront", "Le Caudan",
|
| 81 |
+
"Ebene Cybercity", "Trou aux Biches",
|
| 82 |
+
"Mont Choisy", "Chamarel", "Le Morne",
|
| 83 |
+
"Blue Bay", "La Cambuse", "Ile aux Cerfs",
|
| 84 |
+
"Reduit", "SSR Airport", "Plaisance",
|
| 85 |
+
"Cascavelle", "Medine"
|
| 86 |
+
],
|
| 87 |
+
|
| 88 |
+
# ========================
|
| 89 |
+
# 5. WEEKDAYS (Dictionary entities)
|
| 90 |
+
# ========================
|
| 91 |
+
"WEEKDAY": [
|
| 92 |
+
# Bhojpuri
|
| 93 |
+
"Somvar", "Lendi",
|
| 94 |
+
"Mangal", "Mangar",
|
| 95 |
+
"Budh",
|
| 96 |
+
"Guruwar",
|
| 97 |
+
"Sukar", "Sukrawar",
|
| 98 |
+
"Sani", "Samdi",
|
| 99 |
+
"Raviwaar",
|
| 100 |
+
|
| 101 |
+
# Kreol
|
| 102 |
+
"Lindi", "Mardi", "Merkredi",
|
| 103 |
+
"Zedi", "Vandredi", "Dimans"
|
| 104 |
+
],
|
| 105 |
+
|
| 106 |
+
# ========================
|
| 107 |
+
# 6. MONTHS (Dictionary entities)
|
| 108 |
+
# ========================
|
| 109 |
+
"MONTH": [
|
| 110 |
+
# Bhojpuri / Hindi variants
|
| 111 |
+
"January", "Janvari",
|
| 112 |
+
"February", "Februari",
|
| 113 |
+
"March",
|
| 114 |
+
"April",
|
| 115 |
+
"May",
|
| 116 |
+
"June",
|
| 117 |
+
"July",
|
| 118 |
+
"August",
|
| 119 |
+
"September",
|
| 120 |
+
"October",
|
| 121 |
+
"November",
|
| 122 |
+
"December",
|
| 123 |
+
|
| 124 |
+
# Kreol Morisien
|
| 125 |
+
"Zanvie",
|
| 126 |
+
"Fevriye",
|
| 127 |
+
"Mars",
|
| 128 |
+
"Avril",
|
| 129 |
+
"Me",
|
| 130 |
+
"Zwin",
|
| 131 |
+
"Zilye",
|
| 132 |
+
"Out",
|
| 133 |
+
"Septam",
|
| 134 |
+
"Oktob",
|
| 135 |
+
"Novam",
|
| 136 |
+
"Desam"
|
| 137 |
+
],
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
# ========================
|
| 141 |
+
# 7. PERSON NAMES
|
| 142 |
+
# ========================
|
| 143 |
+
"PERSON": [
|
| 144 |
+
"Amit", "Vikash", "Rishi", "Kiran", "Anil", "Sanjay",
|
| 145 |
+
"Rakesh", "Nikhil", "Kavita", "Reena", "Meera",
|
| 146 |
+
"Neha", "Pooja", "Sunil", "Aisha", "Fatima",
|
| 147 |
+
"Farah", "Yusuf", "Imran", "Jean", "Marie",
|
| 148 |
+
"Patrick", "Stephan", "Yannick", "Kevin",
|
| 149 |
+
"Ramesh", "Champa", "Babita", "Kamal", "Sonu",
|
| 150 |
+
"Guddu", "Sidharth", "Sameer", "Sameerchand", "Karuna"
|
| 151 |
+
],
|
| 152 |
+
|
| 153 |
+
# ========================
|
| 154 |
+
# 8. PRODUCTS / OBJECTS
|
| 155 |
+
# ========================
|
| 156 |
+
"PRODUCT": [
|
| 157 |
+
"Honda Fit", "Honda Vezel", "Suzuki Swift",
|
| 158 |
+
"Toyota Aqua", "Toyota Vitz", "Nissan Note",
|
| 159 |
+
"Mazda Axela", "iPhone", "Samsung",
|
| 160 |
+
"OnePlus", "Pixel", "Redmi"
|
| 161 |
+
],
|
| 162 |
+
|
| 163 |
+
# ========================
|
| 164 |
+
# 9. REGEX PATTERNS
|
| 165 |
+
# ========================
|
| 166 |
+
"REGEX_PATTERNS": {
|
| 167 |
+
"NUMBER": r"\b\d+(?:,\d{3})*(?:\.\d+)?\b",
|
| 168 |
+
"MONEY": r"\b(?:Rs|rs|RS)\s?\d+(?:,\d{3})*\b",
|
| 169 |
+
"DATE": r"\b\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}\b",
|
| 170 |
+
"TIME": r"\b\d{1,2}(?::\d{2})?(?:am|pm|AM|PM)\b",
|
| 171 |
+
"PHONE": r"\b[0-9]{8}\b",
|
| 172 |
+
"EMAIL": r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
# ============================================================
|
| 177 |
+
# WEEKDAY CANONICAL MAP (used during unmasking)
|
| 178 |
+
# ============================================================
|
| 179 |
|
| 180 |
WEEKDAY_MAP = {
|
| 181 |
# Bhojpuri → Kreol
|
| 182 |
"somvar": "lindi",
|
| 183 |
"lendi": "lindi",
|
|
|
|
| 184 |
"mangal": "mardi",
|
| 185 |
"mangar": "mardi",
|
|
|
|
| 186 |
"budh": "merkredi",
|
|
|
|
| 187 |
"guruwar": "zedi",
|
|
|
|
| 188 |
"sukar": "vandredi",
|
| 189 |
"sukrawar": "vandredi",
|
|
|
|
| 190 |
"sani": "samdi",
|
| 191 |
"samdi": "samdi",
|
|
|
|
| 192 |
"raviwaar": "dimans",
|
| 193 |
|
| 194 |
# Kreol → Bhojpuri
|
|
|
|
| 200 |
"samdi": "sani",
|
| 201 |
"dimans": "raviwaar"
|
| 202 |
}
|
| 203 |
+
|
| 204 |
+
# ============================================================
|
| 205 |
+
# MONTH CANONICAL MAP (used during unmasking)
|
| 206 |
+
# ============================================================
|
| 207 |
+
|
| 208 |
+
MONTH_MAP = {
|
| 209 |
+
# English / Bhojpuri → Kreol
|
| 210 |
+
"january": "zanvie",
|
| 211 |
+
"janvari": "zanvie",
|
| 212 |
+
|
| 213 |
+
"february": "fevriye",
|
| 214 |
+
"februari": "fevriye",
|
| 215 |
+
|
| 216 |
+
"march": "mars",
|
| 217 |
+
"april": "avril",
|
| 218 |
+
"may": "me",
|
| 219 |
+
"june": "zwin",
|
| 220 |
+
"july": "zilye",
|
| 221 |
+
"august": "out",
|
| 222 |
+
|
| 223 |
+
"september": "septam",
|
| 224 |
+
"october": "oktob",
|
| 225 |
+
"november": "novam",
|
| 226 |
+
"december": "desam",
|
| 227 |
+
|
| 228 |
+
# Kreol → English (canonical)
|
| 229 |
+
"zanvie": "january",
|
| 230 |
+
"fevriye": "february",
|
| 231 |
+
"mars": "march",
|
| 232 |
+
"avril": "april",
|
| 233 |
+
"me": "may",
|
| 234 |
+
"zwin": "june",
|
| 235 |
+
"zilye": "july",
|
| 236 |
+
"out": "august",
|
| 237 |
+
"septam": "september",
|
| 238 |
+
"oktob": "october",
|
| 239 |
+
"novam": "november",
|
| 240 |
+
"desam": "december"
|
| 241 |
+
}
|
| 242 |
+
|