Spaces:
Running on Zero
Running on Zero
Cheikh Niang commited on
Deploiement GuindiMa AI (interface Gradio)
Browse files- app.py +79 -39
- data/itineraires_dakar.csv +80 -96
- data/sources/build_dataset.py +19 -14
- src/intent/extract_intent.py +22 -5
- src/matching/lieux.py +57 -61
- src/matching/stops_matcher.py +94 -23
- src/tts/pregenerer.py +5 -3
app.py
CHANGED
|
@@ -17,6 +17,7 @@ Le reste du pipeline (extraction, correspondance, voix) tient en CPU et n'a pas
|
|
| 17 |
from __future__ import annotations
|
| 18 |
|
| 19 |
import itertools
|
|
|
|
| 20 |
import os
|
| 21 |
import subprocess
|
| 22 |
import sys
|
|
@@ -216,18 +217,30 @@ def transcrire_wolof(chemin_audio: str) -> str:
|
|
| 216 |
return transcrire(MODELE_WHISPER, audio)
|
| 217 |
|
| 218 |
|
| 219 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
"""La réponse lue en wolof, sous forme de chemin de fichier.
|
| 221 |
|
| 222 |
Cache disque d'abord : à la démo, tout est déjà synthétisé et aucun modèle n'a
|
| 223 |
-
besoin d'être chargé. Synthèse directe seulement s'il manque un morceau
|
|
|
|
| 224 |
"""
|
| 225 |
-
if not lignes:
|
| 226 |
return None
|
| 227 |
-
octets = voix_depuis_cache(lignes) if cache_complet() else None
|
| 228 |
if octets is None:
|
|
|
|
| 229 |
try:
|
| 230 |
-
octets = synthetiser(_tts(),
|
| 231 |
except Exception as exc:
|
| 232 |
print(f"Voix de synthèse indisponible ({exc}), la réponse reste en texte.")
|
| 233 |
return None
|
|
@@ -241,49 +254,76 @@ def _voix_wolof(lignes: list[dict]) -> str | None:
|
|
| 241 |
# --------------------------------------------------------------------------- #
|
| 242 |
|
| 243 |
|
| 244 |
-
def
|
| 245 |
-
"""
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
)
|
| 252 |
-
|
| 253 |
-
if not resultat["found"]:
|
| 254 |
-
hors_reseau = []
|
| 255 |
-
if not resultat["depart_valide"]:
|
| 256 |
-
hors_reseau.append(f"le départ **« {depart} »**")
|
| 257 |
-
if not resultat["arrivee_valide"]:
|
| 258 |
-
hors_reseau.append(f"l'arrivée **« {arrivee} »**")
|
| 259 |
-
detail = " et ".join(hors_reseau) or "ce trajet"
|
| 260 |
-
return (
|
| 261 |
-
"### 🗺 Lieu hors réseau\n\n"
|
| 262 |
-
f"{detail} n'est pas desservi par les lignes du jeu de données. "
|
| 263 |
-
f"Essaie un quartier voisin, par exemple Guédiawaye, Ouakam ou Palais."
|
| 264 |
-
)
|
| 265 |
-
|
| 266 |
-
cartes = []
|
| 267 |
-
for match in resultat["lignes"]:
|
| 268 |
-
numero = numero_de(match["ligne"])
|
| 269 |
-
affiche = numero if numero is not None else match["ligne"]
|
| 270 |
-
rappel = nombre_en_wolof(numero) if numero is not None else ""
|
| 271 |
-
cartes.append(
|
| 272 |
-
f"""
|
| 273 |
<div style="border:1px solid #D6E6DC;border-top:6px solid {VERT};
|
| 274 |
border-radius:12px;padding:16px 20px;margin:8px 0;background:#F6FBF8;">
|
| 275 |
<div style="color:{VERT};font-size:12px;font-weight:700;letter-spacing:.14em;
|
| 276 |
-
text-transform:uppercase;">{
|
| 277 |
<div style="color:{VERT};font-size:56px;font-weight:800;line-height:1.05;
|
| 278 |
margin:4px 0 6px 0;">{affiche}</div>
|
| 279 |
<div style="color:#17211C;font-size:20px;font-weight:600;">
|
| 280 |
{match['depart']} → {match['arrivee']}</div>
|
|
|
|
| 281 |
<div style="color:#6B7A72;font-size:13px;margin-top:6px;">
|
| 282 |
-
{
|
| 283 |
</div>
|
| 284 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
)
|
| 286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
|
| 288 |
|
| 289 |
def _mention(intent: dict) -> str:
|
|
@@ -333,13 +373,13 @@ def trouver_le_bus(audio: str | None, phrase_ecrite: str) -> tuple:
|
|
| 333 |
resultat = MATCHER.find_line(depart, arrivee)
|
| 334 |
|
| 335 |
# Le LLM peut renvoyer un nom hors du réseau (« Marché Liberté », « Géejewaay »)
|
| 336 |
-
# alors que l'extraction locale, alignée sur
|
| 337 |
# Si elle mène à une ligne, on la garde.
|
| 338 |
if not resultat["found"] and intent.get("source") != "local":
|
| 339 |
local = extract_local(phrase)
|
| 340 |
if local.get("depart") and local.get("arrivee"):
|
| 341 |
essai = MATCHER.find_line(local["depart"], local["arrivee"])
|
| 342 |
-
if essai["found"]:
|
| 343 |
depart, arrivee, resultat = local["depart"], local["arrivee"], essai
|
| 344 |
intent = {**intent, "source": "llm+local"}
|
| 345 |
|
|
@@ -347,7 +387,7 @@ def trouver_le_bus(audio: str | None, phrase_ecrite: str) -> tuple:
|
|
| 347 |
phrase,
|
| 348 |
f"{depart} → {arrivee}",
|
| 349 |
_carte(resultat, depart, arrivee),
|
| 350 |
-
_voix_wolof(resultat["lignes"]),
|
| 351 |
_mention(intent),
|
| 352 |
)
|
| 353 |
|
|
|
|
| 17 |
from __future__ import annotations
|
| 18 |
|
| 19 |
import itertools
|
| 20 |
+
import re
|
| 21 |
import os
|
| 22 |
import subprocess
|
| 23 |
import sys
|
|
|
|
| 217 |
return transcrire(MODELE_WHISPER, audio)
|
| 218 |
|
| 219 |
|
| 220 |
+
def _phrase_correspondance(trajet: dict) -> str:
|
| 221 |
+
"""La réponse à dire pour un trajet en deux bus."""
|
| 222 |
+
morceaux = []
|
| 223 |
+
for etape in (trajet["etape_1"], trajet["etape_2"]):
|
| 224 |
+
numero = numero_de(etape["ligne"])
|
| 225 |
+
dit = f"ligne {nombre_en_wolof(numero)}" if numero is not None else etape["ligne"]
|
| 226 |
+
morceaux.append(f"bus bu {etape['compagnie']}, {dit}")
|
| 227 |
+
return f"Jëlal {morceaux[0]}, ba {trajet['changement']}. Ci ginnaaw, jëlal {morceaux[1]}."
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
def _voix_wolof(lignes: list[dict], correspondances: list[dict] | None = None) -> str | None:
|
| 231 |
"""La réponse lue en wolof, sous forme de chemin de fichier.
|
| 232 |
|
| 233 |
Cache disque d'abord : à la démo, tout est déjà synthétisé et aucun modèle n'a
|
| 234 |
+
besoin d'être chargé. Synthèse directe seulement s'il manque un morceau, et
|
| 235 |
+
toujours pour un trajet avec correspondance (phrase propre à chaque trajet).
|
| 236 |
"""
|
| 237 |
+
if not lignes and not correspondances:
|
| 238 |
return None
|
| 239 |
+
octets = voix_depuis_cache(lignes) if lignes and cache_complet() else None
|
| 240 |
if octets is None:
|
| 241 |
+
phrase = phrase_reponse(lignes) if lignes else _phrase_correspondance(correspondances[0])
|
| 242 |
try:
|
| 243 |
+
octets = synthetiser(_tts(), phrase)
|
| 244 |
except Exception as exc:
|
| 245 |
print(f"Voix de synthèse indisponible ({exc}), la réponse reste en texte.")
|
| 246 |
return None
|
|
|
|
| 254 |
# --------------------------------------------------------------------------- #
|
| 255 |
|
| 256 |
|
| 257 |
+
def _une_carte(match: dict, etape: str = "") -> str:
|
| 258 |
+
"""Une ligne : compagnie, numéro, sens, et où monter / descendre."""
|
| 259 |
+
numero = numero_de(match["ligne"])
|
| 260 |
+
affiche = re.sub(r"^Ligne\s*", "", str(match["ligne"]))
|
| 261 |
+
rappel = nombre_en_wolof(numero) if numero is not None else ""
|
| 262 |
+
entete = f"{etape} · {match['compagnie']}" if etape else match["compagnie"]
|
| 263 |
+
trajet = ""
|
| 264 |
+
if match.get("monte_a") and match.get("descend_a"):
|
| 265 |
+
trajet = (
|
| 266 |
+
f"<div style='color:#17211C;font-size:15px;margin-top:6px;'>"
|
| 267 |
+
f"Monte à <b>{match['monte_a']}</b> · descends à <b>{match['descend_a']}</b></div>"
|
| 268 |
)
|
| 269 |
+
return f"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
<div style="border:1px solid #D6E6DC;border-top:6px solid {VERT};
|
| 271 |
border-radius:12px;padding:16px 20px;margin:8px 0;background:#F6FBF8;">
|
| 272 |
<div style="color:{VERT};font-size:12px;font-weight:700;letter-spacing:.14em;
|
| 273 |
+
text-transform:uppercase;">{entete}</div>
|
| 274 |
<div style="color:{VERT};font-size:56px;font-weight:800;line-height:1.05;
|
| 275 |
margin:4px 0 6px 0;">{affiche}</div>
|
| 276 |
<div style="color:#17211C;font-size:20px;font-weight:600;">
|
| 277 |
{match['depart']} → {match['arrivee']}</div>
|
| 278 |
+
{trajet}
|
| 279 |
<div style="color:#6B7A72;font-size:13px;margin-top:6px;">
|
| 280 |
+
{" · ".join(x for x in (rappel, match.get("categorie", "")) if x)}</div>
|
| 281 |
</div>
|
| 282 |
"""
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
def _carte(resultat: dict, depart: str, arrivee: str) -> str:
|
| 286 |
+
"""La réponse en Markdown : compagnie et numéro de ligne mis en avant."""
|
| 287 |
+
if not depart or not arrivee:
|
| 288 |
+
return (
|
| 289 |
+
"### 🤷 Lieu non détecté\n\n"
|
| 290 |
+
"Je n'ai pas trouvé un départ **et** une arrivée dans ta phrase. "
|
| 291 |
+
"Reformule, ou parle plus près du micro."
|
| 292 |
)
|
| 293 |
+
|
| 294 |
+
if resultat["found"]:
|
| 295 |
+
return "".join(_une_carte(match) for match in resultat["lignes"])
|
| 296 |
+
|
| 297 |
+
correspondances = resultat.get("correspondances") or []
|
| 298 |
+
if correspondances:
|
| 299 |
+
blocs = ["### 🔁 Pas de bus direct : un changement suffit\n"]
|
| 300 |
+
for numero, trajet in enumerate(correspondances, start=1):
|
| 301 |
+
if numero > 1:
|
| 302 |
+
blocs.append(f"\n**Autre possibilité {numero}**\n")
|
| 303 |
+
blocs.append(_une_carte(trajet["etape_1"], "1er bus"))
|
| 304 |
+
blocs.append(
|
| 305 |
+
f"<div style='text-align:center;color:#6B7A72;margin:2px 0;'>"
|
| 306 |
+
f"🔁 Change à <b>{trajet['changement']}</b></div>"
|
| 307 |
+
)
|
| 308 |
+
blocs.append(_une_carte(trajet["etape_2"], "2e bus"))
|
| 309 |
+
return "".join(blocs)
|
| 310 |
+
|
| 311 |
+
inconnus = [
|
| 312 |
+
f"**« {lieu} »**"
|
| 313 |
+
for lieu, valide in ((depart, resultat["depart_valide"]), (arrivee, resultat["arrivee_valide"]))
|
| 314 |
+
if not valide
|
| 315 |
+
]
|
| 316 |
+
if inconnus:
|
| 317 |
+
return (
|
| 318 |
+
"### 🗺 Lieu hors réseau\n\n"
|
| 319 |
+
f"Je ne trouve {' ni '.join(inconnus)} sur aucune ligne du jeu de données. "
|
| 320 |
+
"Essaie un quartier ou un arrêt voisin."
|
| 321 |
+
)
|
| 322 |
+
return (
|
| 323 |
+
"### 🗺 Pas de trajet trouvé\n\n"
|
| 324 |
+
f"Je connais **{depart}** et **{arrivee}**, mais aucune ligne ni aucun trajet "
|
| 325 |
+
"avec un seul changement ne les relie dans le jeu de données."
|
| 326 |
+
)
|
| 327 |
|
| 328 |
|
| 329 |
def _mention(intent: dict) -> str:
|
|
|
|
| 373 |
resultat = MATCHER.find_line(depart, arrivee)
|
| 374 |
|
| 375 |
# Le LLM peut renvoyer un nom hors du réseau (« Marché Liberté », « Géejewaay »)
|
| 376 |
+
# alors que l'extraction locale, alignée sur les arrêts, trouve le bon couple.
|
| 377 |
# Si elle mène à une ligne, on la garde.
|
| 378 |
if not resultat["found"] and intent.get("source") != "local":
|
| 379 |
local = extract_local(phrase)
|
| 380 |
if local.get("depart") and local.get("arrivee"):
|
| 381 |
essai = MATCHER.find_line(local["depart"], local["arrivee"])
|
| 382 |
+
if essai["found"] or (essai["correspondances"] and not resultat["correspondances"]):
|
| 383 |
depart, arrivee, resultat = local["depart"], local["arrivee"], essai
|
| 384 |
intent = {**intent, "source": "llm+local"}
|
| 385 |
|
|
|
|
| 387 |
phrase,
|
| 388 |
f"{depart} → {arrivee}",
|
| 389 |
_carte(resultat, depart, arrivee),
|
| 390 |
+
_voix_wolof(resultat["lignes"], resultat.get("correspondances")),
|
| 391 |
_mention(intent),
|
| 392 |
)
|
| 393 |
|
data/itineraires_dakar.csv
CHANGED
|
@@ -144,26 +144,24 @@ Tata AFTU,Ligne 1,17,2 Voies de Liberté VI
|
|
| 144 |
Tata AFTU,Ligne 1,18,VDN
|
| 145 |
Tata AFTU,Ligne 1,19,Rte Corniche de HLM Gd Médine
|
| 146 |
Tata AFTU,Ligne 1,20,Espace HLM Gd Médine (Face Autoroute)
|
| 147 |
-
Tata AFTU,Ligne 1,
|
| 148 |
-
Tata AFTU,Ligne 2,
|
| 149 |
-
Tata AFTU,Ligne 2,
|
| 150 |
-
Tata AFTU,Ligne 2,
|
| 151 |
-
Tata AFTU,Ligne 2,
|
| 152 |
-
Tata AFTU,Ligne 2,
|
| 153 |
-
Tata AFTU,Ligne 2,
|
| 154 |
-
Tata AFTU,Ligne 2,
|
| 155 |
-
Tata AFTU,Ligne 2,
|
| 156 |
-
Tata AFTU,Ligne 2,
|
| 157 |
-
Tata AFTU,Ligne 2,
|
| 158 |
-
Tata AFTU,Ligne 2,
|
| 159 |
-
Tata AFTU,Ligne 2,
|
| 160 |
-
Tata AFTU,Ligne 2,
|
| 161 |
-
Tata AFTU,Ligne 2,
|
| 162 |
-
Tata AFTU,Ligne 2,
|
| 163 |
-
Tata AFTU,Ligne 2,
|
| 164 |
-
Tata AFTU,Ligne 2,
|
| 165 |
-
Tata AFTU,Ligne 2,18,Av Emile Badiane
|
| 166 |
-
Tata AFTU,Ligne 2,19,Gare Petersen
|
| 167 |
Tata AFTU,Ligne 3,1,Yoff-Village
|
| 168 |
Tata AFTU,Ligne 3,2,Autoroute Seydinalimamoulaye
|
| 169 |
Tata AFTU,Ligne 3,3,Aéroport L S Senghor
|
|
@@ -243,7 +241,6 @@ Tata AFTU,Ligne 26,5,Unités 5
|
|
| 243 |
Tata AFTU,Ligne 26,6,Route des Niayes (Guédiawaye)
|
| 244 |
Tata AFTU,Ligne 26,7,Croisement Bethio
|
| 245 |
Tata AFTU,Ligne 26,8,Guédiawaye
|
| 246 |
-
Tata AFTU,Ligne 26,9,Poste Thiaroye
|
| 247 |
Tata AFTU,Ligne 27,1,Marché Boubess
|
| 248 |
Tata AFTU,Ligne 27,2,Stade Amadou Barry
|
| 249 |
Tata AFTU,Ligne 27,3,Djiddah Thiaroye Kao
|
|
@@ -282,7 +279,7 @@ Tata AFTU,Ligne 28,15,Autoroute
|
|
| 282 |
Tata AFTU,Ligne 28,16,Gare Petersen
|
| 283 |
Tata AFTU,Ligne 29,1,Cité Nations Unies (Cambérène)
|
| 284 |
Tata AFTU,Ligne 29,2,Golf
|
| 285 |
-
Tata AFTU,Ligne 29,3,
|
| 286 |
Tata AFTU,Ligne 29,4,Rte des Niayes (Police Parcelles)
|
| 287 |
Tata AFTU,Ligne 29,5,Rond-Point de Cambérène (Casebi)
|
| 288 |
Tata AFTU,Ligne 29,6,Rte des Niayes Prolongée (Police Parcelles)
|
|
@@ -389,13 +386,13 @@ Tata AFTU,Ligne 36,5,Dial Mbaye
|
|
| 389 |
Tata AFTU,Ligne 36,6,Cité Enseignants
|
| 390 |
Tata AFTU,Ligne 36,7,Croisement Bethio
|
| 391 |
Tata AFTU,Ligne 36,8,Pharmacie Golf
|
| 392 |
-
Tata AFTU,Ligne 36,9,Unité 3
|
| 393 |
Tata AFTU,Ligne 36,10,Case Ba
|
| 394 |
Tata AFTU,Ligne 36,11,Parcelles Assainies
|
| 395 |
Tata AFTU,Ligne 36,12,Église
|
| 396 |
Tata AFTU,Ligne 36,13,Caserne Sapeurs Pompiers
|
| 397 |
Tata AFTU,Ligne 36,14,École Dior
|
| 398 |
-
Tata AFTU,Ligne 36,15,Centre
|
| 399 |
Tata AFTU,Ligne 36,16,Yoff Village
|
| 400 |
Tata AFTU,Ligne 36,17,Aéroport
|
| 401 |
Tata AFTU,Ligne 36,18,Ngor
|
|
@@ -508,7 +505,7 @@ Tata AFTU,Ligne 42,12,Route Principale de Ouakam (Marché)
|
|
| 508 |
Tata AFTU,Ligne 42,13,Boutikou Diallo
|
| 509 |
Tata AFTU,Ligne 42,14,Ouakam Baye
|
| 510 |
Tata AFTU,Ligne 43,1,Ouakam
|
| 511 |
-
Tata AFTU,Ligne 43,2,
|
| 512 |
Tata AFTU,Ligne 43,3,École Normale
|
| 513 |
Tata AFTU,Ligne 43,4,Bourguiba
|
| 514 |
Tata AFTU,Ligne 43,5,Rue 10
|
|
@@ -569,7 +566,6 @@ Tata AFTU,Ligne 45,31,Croisement 22
|
|
| 569 |
Tata AFTU,Ligne 45,32,Caserne Sapeurs Pompiers Parcelles
|
| 570 |
Tata AFTU,Ligne 45,33,Parcelles Église
|
| 571 |
Tata AFTU,Ligne 45,34,63
|
| 572 |
-
Tata AFTU,Ligne 45,35,Parcelles Église
|
| 573 |
Tata AFTU,Ligne 46,1,SDE Serigne Assane
|
| 574 |
Tata AFTU,Ligne 46,2,Guédiawaye
|
| 575 |
Tata AFTU,Ligne 46,3,Lycée Limamou Laye
|
|
@@ -591,7 +587,7 @@ Tata AFTU,Ligne 46,18,Avenue Cheikh Antadiop
|
|
| 591 |
Tata AFTU,Ligne 46,19,Avenue Blaise Diagne
|
| 592 |
Tata AFTU,Ligne 46,20,Lat Dior
|
| 593 |
Tata AFTU,Ligne 47,1,Gare Lat-Dior
|
| 594 |
-
Tata AFTU,Ligne 47,2,Service d'
|
| 595 |
Tata AFTU,Ligne 47,3,Av Blaise Diagne
|
| 596 |
Tata AFTU,Ligne 47,4,Av Cheikh Anta Diop
|
| 597 |
Tata AFTU,Ligne 47,5,Av Bourguiba
|
|
@@ -659,7 +655,6 @@ Tata AFTU,Ligne 50,17,Route de Yeumbeul
|
|
| 659 |
Tata AFTU,Ligne 50,18,Bene Baraque
|
| 660 |
Tata AFTU,Ligne 50,19,Malika Cimetière
|
| 661 |
Tata AFTU,Ligne 50,20,Malika Plage
|
| 662 |
-
Tata AFTU,Ligne 50,21,Malika Cimetière
|
| 663 |
Tata AFTU,Ligne 51,1,Jaxaay
|
| 664 |
Tata AFTU,Ligne 51,2,Station Keurmassar
|
| 665 |
Tata AFTU,Ligne 51,3,Hôpital Keur Massar
|
|
@@ -670,21 +665,19 @@ Tata AFTU,Ligne 51,7,Route des Niayes
|
|
| 670 |
Tata AFTU,Ligne 51,8,Tallyicotaf
|
| 671 |
Tata AFTU,Ligne 51,9,Bountou Pikine
|
| 672 |
Tata AFTU,Ligne 51,10,Gare des Baux Maraîchers
|
| 673 |
-
Tata AFTU,Ligne 52,1,
|
| 674 |
-
Tata AFTU,Ligne 52,2,
|
| 675 |
-
Tata AFTU,Ligne 52,3,
|
| 676 |
-
Tata AFTU,Ligne 52,4,
|
| 677 |
-
Tata AFTU,Ligne 52,5,
|
| 678 |
-
Tata AFTU,Ligne 52,6,
|
| 679 |
-
Tata AFTU,Ligne 52,7,
|
| 680 |
-
Tata AFTU,Ligne 52,8,
|
| 681 |
-
Tata AFTU,Ligne 52,9,
|
| 682 |
-
Tata AFTU,Ligne 52,10,
|
| 683 |
-
Tata AFTU,Ligne 52,11,
|
| 684 |
-
Tata AFTU,Ligne 52,12,
|
| 685 |
-
Tata AFTU,Ligne 52,13,
|
| 686 |
-
Tata AFTU,Ligne 52,14,Jaxaay
|
| 687 |
-
Tata AFTU,Ligne 52,15,Keur Massar
|
| 688 |
Tata AFTU,Ligne 53,1,Keur Massar (Marché)
|
| 689 |
Tata AFTU,Ligne 53,2,P11
|
| 690 |
Tata AFTU,Ligne 53,3,Croisement Tivaouane Peulh
|
|
@@ -728,19 +721,18 @@ Tata AFTU,Ligne 55,10,Autoroute
|
|
| 728 |
Tata AFTU,Ligne 55,11,Av Malick Sy
|
| 729 |
Tata AFTU,Ligne 55,12,Allées Papa Gueye Fall
|
| 730 |
Tata AFTU,Ligne 55,13,Petersen
|
| 731 |
-
Tata AFTU,Ligne 56,1,Jaxaay
|
| 732 |
-
Tata AFTU,Ligne 56,2,
|
| 733 |
-
Tata AFTU,Ligne 56,3,
|
| 734 |
-
Tata AFTU,Ligne 56,4,
|
| 735 |
-
Tata AFTU,Ligne 56,5,
|
| 736 |
-
Tata AFTU,Ligne 56,6,
|
| 737 |
-
Tata AFTU,Ligne 56,7,
|
| 738 |
-
Tata AFTU,Ligne 56,8,
|
| 739 |
-
Tata AFTU,Ligne 56,9,
|
| 740 |
-
Tata AFTU,Ligne 56,10,
|
| 741 |
-
Tata AFTU,Ligne 56,11,
|
| 742 |
-
Tata AFTU,Ligne 56,12,
|
| 743 |
-
Tata AFTU,Ligne 56,13,Petersen
|
| 744 |
Tata AFTU,Ligne 57,1,Rond-Point Liberté 6
|
| 745 |
Tata AFTU,Ligne 57,2,Av Hyacinthe Thiandoum
|
| 746 |
Tata AFTU,Ligne 57,3,Grand Yoff
|
|
@@ -755,20 +747,18 @@ Tata AFTU,Ligne 57,11,Bd Maurice Gueye
|
|
| 755 |
Tata AFTU,Ligne 57,12,Poste Courant
|
| 756 |
Tata AFTU,Ligne 57,13,Marché Colobane Rufisque
|
| 757 |
Tata AFTU,Ligne 57,14,Rufisque Gouye Mouride
|
| 758 |
-
Tata AFTU,Ligne 58,1,
|
| 759 |
-
Tata AFTU,Ligne 58,2,
|
| 760 |
-
Tata AFTU,Ligne 58,3,
|
| 761 |
-
Tata AFTU,Ligne 58,4,
|
| 762 |
-
Tata AFTU,Ligne 58,5,
|
| 763 |
-
Tata AFTU,Ligne 58,6,
|
| 764 |
-
Tata AFTU,Ligne 58,7,
|
| 765 |
-
Tata AFTU,Ligne 58,8,
|
| 766 |
-
Tata AFTU,Ligne 58,9,
|
| 767 |
-
Tata AFTU,Ligne 58,10,
|
| 768 |
-
Tata AFTU,Ligne 58,11,
|
| 769 |
-
Tata AFTU,Ligne 58,12,
|
| 770 |
-
Tata AFTU,Ligne 58,13,SHAM
|
| 771 |
-
Tata AFTU,Ligne 58,14,Comico
|
| 772 |
Tata AFTU,Ligne 59,1,Diamalaye
|
| 773 |
Tata AFTU,Ligne 59,2,Stade L.s.s
|
| 774 |
Tata AFTU,Ligne 59,3,Police Parcelles
|
|
@@ -841,25 +831,22 @@ Tata AFTU,Ligne 63,15,Rond-Point Cambérène (Case Bi)
|
|
| 841 |
Tata AFTU,Ligne 63,16,Police des Parcelles Assainies
|
| 842 |
Tata AFTU,Ligne 63,17,Route du Stade (Taliboubess)
|
| 843 |
Tata AFTU,Ligne 63,18,Parcelles Dior
|
| 844 |
-
Tata AFTU,Ligne
|
| 845 |
-
Tata AFTU,Ligne 64,
|
| 846 |
-
Tata AFTU,Ligne 64,
|
| 847 |
-
Tata AFTU,Ligne 64,
|
| 848 |
-
Tata AFTU,Ligne 64,
|
| 849 |
-
Tata AFTU,Ligne 64,
|
| 850 |
-
Tata AFTU,Ligne 64,
|
| 851 |
-
Tata AFTU,Ligne 64,
|
| 852 |
-
Tata AFTU,Ligne 64,
|
| 853 |
-
Tata AFTU,Ligne 64,
|
| 854 |
-
Tata AFTU,Ligne 64,
|
| 855 |
-
Tata AFTU,Ligne 64,
|
| 856 |
-
Tata AFTU,Ligne 64,
|
| 857 |
-
Tata AFTU,Ligne 64,
|
| 858 |
-
Tata AFTU,Ligne 64,
|
| 859 |
-
Tata AFTU,Ligne 64,
|
| 860 |
-
Tata AFTU,Ligne 64,16,Dial Mbaay
|
| 861 |
-
Tata AFTU,Ligne 64,17,Notaire
|
| 862 |
-
Tata AFTU,Ligne 64,18,Rufisque
|
| 863 |
Tata AFTU,Ligne 65,1,Gare routière de Colobane
|
| 864 |
Tata AFTU,Ligne 65,2,Rocade Fann Bel-Air
|
| 865 |
Tata AFTU,Ligne 65,3,Place Bakou
|
|
@@ -941,7 +928,6 @@ Tata AFTU,Ligne 69,12,Rond-Point Station Shell Keur Massar
|
|
| 941 |
Tata AFTU,Ligne 69,13,P11 Keur Massar
|
| 942 |
Tata AFTU,Ligne 69,14,Tivaouane Peulh
|
| 943 |
Tata AFTU,Ligne 69,15,Namora
|
| 944 |
-
Tata AFTU,Ligne 69,16,Tivaouane Peulh
|
| 945 |
Tata AFTU,Ligne 70,1,Daroukhane Keur Serigne Assane
|
| 946 |
Tata AFTU,Ligne 70,2,SDE Guédiawaye
|
| 947 |
Tata AFTU,Ligne 70,3,Marché Boubess
|
|
@@ -1006,7 +992,7 @@ Tata AFTU,Ligne 73,7,MTOA
|
|
| 1006 |
Tata AFTU,Ligne 73,8,Boune
|
| 1007 |
Tata AFTU,Ligne 73,9,Yeumbeul
|
| 1008 |
Tata AFTU,Ligne 73,10,Poste Thiaroye
|
| 1009 |
-
Tata AFTU,Ligne 74,1,Bargny (Gare
|
| 1010 |
Tata AFTU,Ligne 74,2,Colobane Rufisque
|
| 1011 |
Tata AFTU,Ligne 74,3,Poste Courant
|
| 1012 |
Tata AFTU,Ligne 74,4,Route Nationale N°1
|
|
@@ -1020,7 +1006,6 @@ Tata AFTU,Ligne 74,11,Keurmassar
|
|
| 1020 |
Tata AFTU,Ligne 74,12,Tivaouane Peul
|
| 1021 |
Tata AFTU,Ligne 74,13,Cité SOCABEG
|
| 1022 |
Tata AFTU,Ligne 74,14,Cité COCEHAS
|
| 1023 |
-
Tata AFTU,Ligne 74,15,Tivaouane Peulh
|
| 1024 |
Tata AFTU,Ligne 75,1,Malika (Cité Sonatel)
|
| 1025 |
Tata AFTU,Ligne 75,2,Yeumbeul
|
| 1026 |
Tata AFTU,Ligne 75,3,Tally Diallo
|
|
@@ -1122,14 +1107,13 @@ Tata AFTU,Ligne 81,13,Croisement Tivaouane Peulh
|
|
| 1122 |
Tata AFTU,Ligne 81,14,Tivaouane Peulh
|
| 1123 |
Tata AFTU,Ligne 81,15,Cité SOCABEG
|
| 1124 |
Tata AFTU,Ligne 81,16,Tawfeex
|
| 1125 |
-
Tata AFTU,Ligne 81,17,Tivaouane Peulh
|
| 1126 |
Tata AFTU,Ligne 82,1,Lat Dior
|
| 1127 |
-
Tata AFTU,Ligne 82,2,Service d'
|
| 1128 |
Tata AFTU,Ligne 82,3,Avenue Blaise Diagne
|
| 1129 |
-
Tata AFTU,Ligne 82,4,Marché
|
| 1130 |
Tata AFTU,Ligne 82,5,Rue 22
|
| 1131 |
Tata AFTU,Ligne 82,6,Rue 37
|
| 1132 |
-
Tata AFTU,Ligne 82,7,Place de l'
|
| 1133 |
Tata AFTU,Ligne 82,8,Lycée Kennedy
|
| 1134 |
Tata AFTU,Ligne 82,9,Colobane
|
| 1135 |
Tata AFTU,Ligne 82,10,Autoroute A Péage
|
|
|
|
| 144 |
Tata AFTU,Ligne 1,18,VDN
|
| 145 |
Tata AFTU,Ligne 1,19,Rte Corniche de HLM Gd Médine
|
| 146 |
Tata AFTU,Ligne 1,20,Espace HLM Gd Médine (Face Autoroute)
|
| 147 |
+
Tata AFTU,Ligne 2,1,Route Principale des Parcelles Assainies
|
| 148 |
+
Tata AFTU,Ligne 2,2,Croisement Dior
|
| 149 |
+
Tata AFTU,Ligne 2,3,Route HLM Grand Médine
|
| 150 |
+
Tata AFTU,Ligne 2,4,Route du Marché des Parcelles Assainies
|
| 151 |
+
Tata AFTU,Ligne 2,5,Route des Niayes
|
| 152 |
+
Tata AFTU,Ligne 2,6,Pont de l'Émergence
|
| 153 |
+
Tata AFTU,Ligne 2,7,Avenue Cardinal Hyacinthe Thiandoum
|
| 154 |
+
Tata AFTU,Ligne 2,8,Giratoire Liberté VI
|
| 155 |
+
Tata AFTU,Ligne 2,9,Route du Front de Terre
|
| 156 |
+
Tata AFTU,Ligne 2,10,Rue P
|
| 157 |
+
Tata AFTU,Ligne 2,11,Avenue Cheikh Amadou Bamba (Rue 13 des HLM)
|
| 158 |
+
Tata AFTU,Ligne 2,12,Boulevard du Général de Gaulle
|
| 159 |
+
Tata AFTU,Ligne 2,13,Rue 39 (Retour Par Rue 17)
|
| 160 |
+
Tata AFTU,Ligne 2,14,Rue 22
|
| 161 |
+
Tata AFTU,Ligne 2,15,Rue 25 (Retour Par Rue 37)
|
| 162 |
+
Tata AFTU,Ligne 2,16,Av Blaise Diagne
|
| 163 |
+
Tata AFTU,Ligne 2,17,Av Emile Badiane
|
| 164 |
+
Tata AFTU,Ligne 2,18,Gare Petersen
|
|
|
|
|
|
|
| 165 |
Tata AFTU,Ligne 3,1,Yoff-Village
|
| 166 |
Tata AFTU,Ligne 3,2,Autoroute Seydinalimamoulaye
|
| 167 |
Tata AFTU,Ligne 3,3,Aéroport L S Senghor
|
|
|
|
| 241 |
Tata AFTU,Ligne 26,6,Route des Niayes (Guédiawaye)
|
| 242 |
Tata AFTU,Ligne 26,7,Croisement Bethio
|
| 243 |
Tata AFTU,Ligne 26,8,Guédiawaye
|
|
|
|
| 244 |
Tata AFTU,Ligne 27,1,Marché Boubess
|
| 245 |
Tata AFTU,Ligne 27,2,Stade Amadou Barry
|
| 246 |
Tata AFTU,Ligne 27,3,Djiddah Thiaroye Kao
|
|
|
|
| 279 |
Tata AFTU,Ligne 28,16,Gare Petersen
|
| 280 |
Tata AFTU,Ligne 29,1,Cité Nations Unies (Cambérène)
|
| 281 |
Tata AFTU,Ligne 29,2,Golf
|
| 282 |
+
Tata AFTU,Ligne 29,3,Cinéma Parcelles
|
| 283 |
Tata AFTU,Ligne 29,4,Rte des Niayes (Police Parcelles)
|
| 284 |
Tata AFTU,Ligne 29,5,Rond-Point de Cambérène (Casebi)
|
| 285 |
Tata AFTU,Ligne 29,6,Rte des Niayes Prolongée (Police Parcelles)
|
|
|
|
| 386 |
Tata AFTU,Ligne 36,6,Cité Enseignants
|
| 387 |
Tata AFTU,Ligne 36,7,Croisement Bethio
|
| 388 |
Tata AFTU,Ligne 36,8,Pharmacie Golf
|
| 389 |
+
Tata AFTU,Ligne 36,9,Unité 3 Cinéma
|
| 390 |
Tata AFTU,Ligne 36,10,Case Ba
|
| 391 |
Tata AFTU,Ligne 36,11,Parcelles Assainies
|
| 392 |
Tata AFTU,Ligne 36,12,Église
|
| 393 |
Tata AFTU,Ligne 36,13,Caserne Sapeurs Pompiers
|
| 394 |
Tata AFTU,Ligne 36,14,École Dior
|
| 395 |
+
Tata AFTU,Ligne 36,15,Centre Aéré de la BCEAO
|
| 396 |
Tata AFTU,Ligne 36,16,Yoff Village
|
| 397 |
Tata AFTU,Ligne 36,17,Aéroport
|
| 398 |
Tata AFTU,Ligne 36,18,Ngor
|
|
|
|
| 505 |
Tata AFTU,Ligne 42,13,Boutikou Diallo
|
| 506 |
Tata AFTU,Ligne 42,14,Ouakam Baye
|
| 507 |
Tata AFTU,Ligne 43,1,Ouakam
|
| 508 |
+
Tata AFTU,Ligne 43,2,Siège Expresso Ouakam
|
| 509 |
Tata AFTU,Ligne 43,3,École Normale
|
| 510 |
Tata AFTU,Ligne 43,4,Bourguiba
|
| 511 |
Tata AFTU,Ligne 43,5,Rue 10
|
|
|
|
| 566 |
Tata AFTU,Ligne 45,32,Caserne Sapeurs Pompiers Parcelles
|
| 567 |
Tata AFTU,Ligne 45,33,Parcelles Église
|
| 568 |
Tata AFTU,Ligne 45,34,63
|
|
|
|
| 569 |
Tata AFTU,Ligne 46,1,SDE Serigne Assane
|
| 570 |
Tata AFTU,Ligne 46,2,Guédiawaye
|
| 571 |
Tata AFTU,Ligne 46,3,Lycée Limamou Laye
|
|
|
|
| 587 |
Tata AFTU,Ligne 46,19,Avenue Blaise Diagne
|
| 588 |
Tata AFTU,Ligne 46,20,Lat Dior
|
| 589 |
Tata AFTU,Ligne 47,1,Gare Lat-Dior
|
| 590 |
+
Tata AFTU,Ligne 47,2,Service d'Hygiène
|
| 591 |
Tata AFTU,Ligne 47,3,Av Blaise Diagne
|
| 592 |
Tata AFTU,Ligne 47,4,Av Cheikh Anta Diop
|
| 593 |
Tata AFTU,Ligne 47,5,Av Bourguiba
|
|
|
|
| 655 |
Tata AFTU,Ligne 50,18,Bene Baraque
|
| 656 |
Tata AFTU,Ligne 50,19,Malika Cimetière
|
| 657 |
Tata AFTU,Ligne 50,20,Malika Plage
|
|
|
|
| 658 |
Tata AFTU,Ligne 51,1,Jaxaay
|
| 659 |
Tata AFTU,Ligne 51,2,Station Keurmassar
|
| 660 |
Tata AFTU,Ligne 51,3,Hôpital Keur Massar
|
|
|
|
| 665 |
Tata AFTU,Ligne 51,8,Tallyicotaf
|
| 666 |
Tata AFTU,Ligne 51,9,Bountou Pikine
|
| 667 |
Tata AFTU,Ligne 51,10,Gare des Baux Maraîchers
|
| 668 |
+
Tata AFTU,Ligne 52,1,Beaux Maraîchers
|
| 669 |
+
Tata AFTU,Ligne 52,2,Bountou Pikine
|
| 670 |
+
Tata AFTU,Ligne 52,3,Marché Chavanel
|
| 671 |
+
Tata AFTU,Ligne 52,4,Tally Boumack
|
| 672 |
+
Tata AFTU,Ligne 52,5,Route des Niayes
|
| 673 |
+
Tata AFTU,Ligne 52,6,Police Thiaroye
|
| 674 |
+
Tata AFTU,Ligne 52,7,Tally Diallo
|
| 675 |
+
Tata AFTU,Ligne 52,8,Yeumbeul
|
| 676 |
+
Tata AFTU,Ligne 52,9,Bene Baraque
|
| 677 |
+
Tata AFTU,Ligne 52,10,Malika
|
| 678 |
+
Tata AFTU,Ligne 52,11,Hôpital Keur Massar
|
| 679 |
+
Tata AFTU,Ligne 52,12,Station Keur Massar
|
| 680 |
+
Tata AFTU,Ligne 52,13,Jaxaay
|
|
|
|
|
|
|
| 681 |
Tata AFTU,Ligne 53,1,Keur Massar (Marché)
|
| 682 |
Tata AFTU,Ligne 53,2,P11
|
| 683 |
Tata AFTU,Ligne 53,3,Croisement Tivaouane Peulh
|
|
|
|
| 721 |
Tata AFTU,Ligne 55,11,Av Malick Sy
|
| 722 |
Tata AFTU,Ligne 55,12,Allées Papa Gueye Fall
|
| 723 |
Tata AFTU,Ligne 55,13,Petersen
|
| 724 |
+
Tata AFTU,Ligne 56,1,Jaxaay 1
|
| 725 |
+
Tata AFTU,Ligne 56,2,Cité Mame Dior
|
| 726 |
+
Tata AFTU,Ligne 56,3,Rond-Point Shell Keur Massar
|
| 727 |
+
Tata AFTU,Ligne 56,4,Croisement Keur Massar
|
| 728 |
+
Tata AFTU,Ligne 56,5,Poste Thiaroye
|
| 729 |
+
Tata AFTU,Ligne 56,6,Bountou Pikine
|
| 730 |
+
Tata AFTU,Ligne 56,7,Croisement Cambérène
|
| 731 |
+
Tata AFTU,Ligne 56,8,Echangeur Patte d'Oie
|
| 732 |
+
Tata AFTU,Ligne 56,9,Autoroute
|
| 733 |
+
Tata AFTU,Ligne 56,10,Av Malick Sy
|
| 734 |
+
Tata AFTU,Ligne 56,11,Allées Papa Gueye Fall
|
| 735 |
+
Tata AFTU,Ligne 56,12,Petersen
|
|
|
|
| 736 |
Tata AFTU,Ligne 57,1,Rond-Point Liberté 6
|
| 737 |
Tata AFTU,Ligne 57,2,Av Hyacinthe Thiandoum
|
| 738 |
Tata AFTU,Ligne 57,3,Grand Yoff
|
|
|
|
| 747 |
Tata AFTU,Ligne 57,12,Poste Courant
|
| 748 |
Tata AFTU,Ligne 57,13,Marché Colobane Rufisque
|
| 749 |
Tata AFTU,Ligne 57,14,Rufisque Gouye Mouride
|
| 750 |
+
Tata AFTU,Ligne 58,1,Fass Mbao (Rail-Ba)
|
| 751 |
+
Tata AFTU,Ligne 58,2,Route Nationale 1
|
| 752 |
+
Tata AFTU,Ligne 58,3,Fass Mbao
|
| 753 |
+
Tata AFTU,Ligne 58,4,SICAP Mbao
|
| 754 |
+
Tata AFTU,Ligne 58,5,Diamaguène
|
| 755 |
+
Tata AFTU,Ligne 58,6,Poste Thiaroye
|
| 756 |
+
Tata AFTU,Ligne 58,7,Péage
|
| 757 |
+
Tata AFTU,Ligne 58,8,Echangeur Hann
|
| 758 |
+
Tata AFTU,Ligne 58,9,Avenue Bourguiba
|
| 759 |
+
Tata AFTU,Ligne 58,10,École Normale
|
| 760 |
+
Tata AFTU,Ligne 58,11,UCAD
|
| 761 |
+
Tata AFTU,Ligne 58,12,SHAM
|
|
|
|
|
|
|
| 762 |
Tata AFTU,Ligne 59,1,Diamalaye
|
| 763 |
Tata AFTU,Ligne 59,2,Stade L.s.s
|
| 764 |
Tata AFTU,Ligne 59,3,Police Parcelles
|
|
|
|
| 831 |
Tata AFTU,Ligne 63,16,Police des Parcelles Assainies
|
| 832 |
Tata AFTU,Ligne 63,17,Route du Stade (Taliboubess)
|
| 833 |
Tata AFTU,Ligne 63,18,Parcelles Dior
|
| 834 |
+
Tata AFTU,Ligne 64,1,Diamniadio
|
| 835 |
+
Tata AFTU,Ligne 64,2,Bargny
|
| 836 |
+
Tata AFTU,Ligne 64,3,Thiawlène
|
| 837 |
+
Tata AFTU,Ligne 64,4,Boulevard Maurice Gueye
|
| 838 |
+
Tata AFTU,Ligne 64,5,Rond-Point Dioutyba
|
| 839 |
+
Tata AFTU,Ligne 64,6,Keur Mbaye Fall
|
| 840 |
+
Tata AFTU,Ligne 64,7,Croisement Keur Massar
|
| 841 |
+
Tata AFTU,Ligne 64,8,Poste Thiaroye
|
| 842 |
+
Tata AFTU,Ligne 64,9,Bountou Pikine
|
| 843 |
+
Tata AFTU,Ligne 64,10,Tally Boumack
|
| 844 |
+
Tata AFTU,Ligne 64,11,Route des Niayes
|
| 845 |
+
Tata AFTU,Ligne 64,12,Tribunal de Pikine
|
| 846 |
+
Tata AFTU,Ligne 64,13,Croisement PAI
|
| 847 |
+
Tata AFTU,Ligne 64,14,72
|
| 848 |
+
Tata AFTU,Ligne 64,15,Dial Mbaay
|
| 849 |
+
Tata AFTU,Ligne 64,16,Notaire
|
|
|
|
|
|
|
|
|
|
| 850 |
Tata AFTU,Ligne 65,1,Gare routière de Colobane
|
| 851 |
Tata AFTU,Ligne 65,2,Rocade Fann Bel-Air
|
| 852 |
Tata AFTU,Ligne 65,3,Place Bakou
|
|
|
|
| 928 |
Tata AFTU,Ligne 69,13,P11 Keur Massar
|
| 929 |
Tata AFTU,Ligne 69,14,Tivaouane Peulh
|
| 930 |
Tata AFTU,Ligne 69,15,Namora
|
|
|
|
| 931 |
Tata AFTU,Ligne 70,1,Daroukhane Keur Serigne Assane
|
| 932 |
Tata AFTU,Ligne 70,2,SDE Guédiawaye
|
| 933 |
Tata AFTU,Ligne 70,3,Marché Boubess
|
|
|
|
| 992 |
Tata AFTU,Ligne 73,8,Boune
|
| 993 |
Tata AFTU,Ligne 73,9,Yeumbeul
|
| 994 |
Tata AFTU,Ligne 73,10,Poste Thiaroye
|
| 995 |
+
Tata AFTU,Ligne 74,1,Bargny (Gare Ferroviaire)
|
| 996 |
Tata AFTU,Ligne 74,2,Colobane Rufisque
|
| 997 |
Tata AFTU,Ligne 74,3,Poste Courant
|
| 998 |
Tata AFTU,Ligne 74,4,Route Nationale N°1
|
|
|
|
| 1006 |
Tata AFTU,Ligne 74,12,Tivaouane Peul
|
| 1007 |
Tata AFTU,Ligne 74,13,Cité SOCABEG
|
| 1008 |
Tata AFTU,Ligne 74,14,Cité COCEHAS
|
|
|
|
| 1009 |
Tata AFTU,Ligne 75,1,Malika (Cité Sonatel)
|
| 1010 |
Tata AFTU,Ligne 75,2,Yeumbeul
|
| 1011 |
Tata AFTU,Ligne 75,3,Tally Diallo
|
|
|
|
| 1107 |
Tata AFTU,Ligne 81,14,Tivaouane Peulh
|
| 1108 |
Tata AFTU,Ligne 81,15,Cité SOCABEG
|
| 1109 |
Tata AFTU,Ligne 81,16,Tawfeex
|
|
|
|
| 1110 |
Tata AFTU,Ligne 82,1,Lat Dior
|
| 1111 |
+
Tata AFTU,Ligne 82,2,Service d'Hygiène
|
| 1112 |
Tata AFTU,Ligne 82,3,Avenue Blaise Diagne
|
| 1113 |
+
Tata AFTU,Ligne 82,4,Marché Tilène
|
| 1114 |
Tata AFTU,Ligne 82,5,Rue 22
|
| 1115 |
Tata AFTU,Ligne 82,6,Rue 37
|
| 1116 |
+
Tata AFTU,Ligne 82,7,Place de l'Obélisque
|
| 1117 |
Tata AFTU,Ligne 82,8,Lycée Kennedy
|
| 1118 |
Tata AFTU,Ligne 82,9,Colobane
|
| 1119 |
Tata AFTU,Ligne 82,10,Autoroute A Péage
|
data/sources/build_dataset.py
CHANGED
|
@@ -8,8 +8,8 @@ Entrées (dans data/) :
|
|
| 8 |
- sources/ddd_itineraires.txt : arrêts DDD relevés dans OpenStreetMap.
|
| 9 |
|
| 10 |
Sortie : data/itineraires_dakar.csv (compagnie, ligne, ordre, arret), une ligne
|
| 11 |
-
par arrêt,
|
| 12 |
-
terminus : on
|
| 13 |
"""
|
| 14 |
|
| 15 |
from __future__ import annotations
|
|
@@ -25,8 +25,8 @@ sys.path.insert(0, str(DATA.parent / "src"))
|
|
| 25 |
from matching.lieux import joli, score # noqa: E402
|
| 26 |
|
| 27 |
# Les tirets séparent les arrêts, sauf dans les noms composés (« YOFF-VILLAGE »,
|
| 28 |
-
# « ROND-POINT ») : un tiret ne coupe que s'il
|
| 29 |
-
#
|
| 30 |
SEPARATEUR = re.compile(r"\s*–+\s*|\s+-+\s*|\s*-+\s+")
|
| 31 |
# Morceaux coupés à tort dans la source (« LAT - DIOR », « CASE - BA »).
|
| 32 |
A_RECOLLER = {("lat", "dior"), ("case", "ba"), ("rond", "point"), ("grand", "yoff")}
|
|
@@ -37,11 +37,12 @@ def decouper(itineraire: str) -> list[str]:
|
|
| 37 |
morceaux = [m for m in morceaux if m and not re.fullmatch(r"[\d\s:]+", m)]
|
| 38 |
sortie: list[str] = []
|
| 39 |
for morceau in morceaux:
|
| 40 |
-
if sortie:
|
| 41 |
-
precedent = sortie[-1].lower().split()[-1]
|
| 42 |
premier = morceau.lower().split()[0]
|
| 43 |
if (precedent, premier) in A_RECOLLER and len(sortie[-1].split()) <= 2:
|
| 44 |
-
|
|
|
|
| 45 |
continue
|
| 46 |
sortie.append(morceau)
|
| 47 |
return [joli(m) for m in sortie]
|
|
@@ -89,14 +90,18 @@ def main() -> None:
|
|
| 89 |
arrets.reverse()
|
| 90 |
# Quand le terminus officiel est déjà en tête de liste, on garde la forme
|
| 91 |
# la plus complète : « Gadaye (Guédiawaye) » plutôt que « Gadaye ».
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
else:
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
for ordre, arret in enumerate(arrets, start=1):
|
| 101 |
lignes_sortie.append(
|
| 102 |
{"compagnie": ligne["compagnie"], "ligne": ligne["ligne"], "ordre": ordre, "arret": arret}
|
|
|
|
| 8 |
- sources/ddd_itineraires.txt : arrêts DDD relevés dans OpenStreetMap.
|
| 9 |
|
| 10 |
Sortie : data/itineraires_dakar.csv (compagnie, ligne, ordre, arret), une ligne
|
| 11 |
+
par arrêt, dans le sens terminus_a -> terminus_b. Une ligne sans itinéraire
|
| 12 |
+
connu n'a que ses deux terminus : on la trouve toujours d'un bout à l'autre.
|
| 13 |
"""
|
| 14 |
|
| 15 |
from __future__ import annotations
|
|
|
|
| 25 |
from matching.lieux import joli, score # noqa: E402
|
| 26 |
|
| 27 |
# Les tirets séparent les arrêts, sauf dans les noms composés (« YOFF-VILLAGE »,
|
| 28 |
+
# « ROND-POINT ») : un tiret ne coupe que s'il touche au moins une espace ; le
|
| 29 |
+
# tiret long (–) coupe toujours.
|
| 30 |
SEPARATEUR = re.compile(r"\s*–+\s*|\s+-+\s*|\s*-+\s+")
|
| 31 |
# Morceaux coupés à tort dans la source (« LAT - DIOR », « CASE - BA »).
|
| 32 |
A_RECOLLER = {("lat", "dior"), ("case", "ba"), ("rond", "point"), ("grand", "yoff")}
|
|
|
|
| 37 |
morceaux = [m for m in morceaux if m and not re.fullmatch(r"[\d\s:]+", m)]
|
| 38 |
sortie: list[str] = []
|
| 39 |
for morceau in morceaux:
|
| 40 |
+
if sortie and sortie[-1].split():
|
| 41 |
+
precedent = sortie[-1].lower().split()[-1]
|
| 42 |
premier = morceau.lower().split()[0]
|
| 43 |
if (precedent, premier) in A_RECOLLER and len(sortie[-1].split()) <= 2:
|
| 44 |
+
lien = "-" if precedent == "rond" else " "
|
| 45 |
+
sortie[-1] = f"{sortie[-1]}{lien}{morceau}"
|
| 46 |
continue
|
| 47 |
sortie.append(morceau)
|
| 48 |
return [joli(m) for m in sortie]
|
|
|
|
| 90 |
arrets.reverse()
|
| 91 |
# Quand le terminus officiel est déjà en tête de liste, on garde la forme
|
| 92 |
# la plus complète : « Gadaye (Guédiawaye) » plutôt que « Gadaye ».
|
| 93 |
+
# Une ligne sans itinéraire publié se résume à ses deux terminus. Quand
|
| 94 |
+
# l'itinéraire existe, il fait foi : un terminus de la liste qu'il ne
|
| 95 |
+
# cite pas (ligne 26 : « Post Thiaroye ») n'est pas ajouté, pour ne pas
|
| 96 |
+
# inventer un tronçon.
|
| 97 |
+
if not arrets:
|
| 98 |
+
arrets = [a, b]
|
| 99 |
else:
|
| 100 |
+
if proche(arrets[0], a):
|
| 101 |
+
arrets[0] = max(arrets[0], a, key=len)
|
| 102 |
+
if proche(arrets[-1], b):
|
| 103 |
+
arrets[-1] = max(arrets[-1], b, key=len)
|
| 104 |
+
|
| 105 |
for ordre, arret in enumerate(arrets, start=1):
|
| 106 |
lignes_sortie.append(
|
| 107 |
{"compagnie": ligne["compagnie"], "ligne": ligne["ligne"], "ordre": ordre, "arret": arret}
|
src/intent/extract_intent.py
CHANGED
|
@@ -17,7 +17,7 @@ from pathlib import Path
|
|
| 17 |
|
| 18 |
from dotenv import load_dotenv
|
| 19 |
|
| 20 |
-
try: # import à plat (app.py, Streamlit) ou depuis src/
|
| 21 |
from matching.lieux import lieux_reconnaissables
|
| 22 |
except ImportError: # pragma: no cover
|
| 23 |
import sys
|
|
@@ -269,6 +269,8 @@ REPLACEMENTS_PHRASE = (
|
|
| 269 |
# « ou ouakam », la règle réécrivant son propre suffixe.
|
| 270 |
(r"(?<!ou)(?:wakaam|wakam)\b", " ouakam "),
|
| 271 |
(r"(?:palee|paale|pale|pali)\b", " palais "),
|
|
|
|
|
|
|
| 272 |
(r"meddina\b", " medina "),
|
| 273 |
# whisper-small entend « liberation » pour « Liberté ».
|
| 274 |
(r"\bliberation\b", " liberte "),
|
|
@@ -305,8 +307,13 @@ def _sans_accents(texte: str) -> str:
|
|
| 305 |
|
| 306 |
# Construit après _sans_accents : une liste comprehendue au niveau du module est
|
| 307 |
# évaluée immédiatement, elle a besoin de la fonction déjà définie.
|
| 308 |
-
|
| 309 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
]
|
| 311 |
|
| 312 |
|
|
@@ -348,6 +355,13 @@ MOTS_DE_LA_PHRASE = {
|
|
| 348 |
"fa", "wax", "nga", "ngay", "jem", "dafa", "def", "bus", "bi", "yi", "mu", "ak",
|
| 349 |
"de", "deu", "dee", "dawal", "jel", "jeel", "won", "ana", "fan", "fu",
|
| 350 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
|
| 352 |
|
| 353 |
def _chercher_lieux(mots: list[str]) -> list[tuple[int, int, str]]:
|
|
@@ -358,9 +372,12 @@ def _chercher_lieux(mots: list[str]) -> list[tuple[int, int, str]]:
|
|
| 358 |
candidats: list[tuple[float, int, int, str]] = []
|
| 359 |
for taille in range(1, TAILLE_NGRAMMES + 1):
|
| 360 |
for debut in range(len(mots) - taille + 1):
|
| 361 |
-
|
|
|
|
|
|
|
|
|
|
| 362 |
continue
|
| 363 |
-
gramme = " ".join(
|
| 364 |
if len(gramme) < LONGUEUR_MIN:
|
| 365 |
continue
|
| 366 |
for lieu_normalise, lieu_exact in _CIBLES:
|
|
|
|
| 17 |
|
| 18 |
from dotenv import load_dotenv
|
| 19 |
|
| 20 |
+
try: # import à plat (app.py, Streamlit) ou lancé depuis src/intent/
|
| 21 |
from matching.lieux import lieux_reconnaissables
|
| 22 |
except ImportError: # pragma: no cover
|
| 23 |
import sys
|
|
|
|
| 269 |
# « ou ouakam », la règle réécrivant son propre suffixe.
|
| 270 |
(r"(?<!ou)(?:wakaam|wakam)\b", " ouakam "),
|
| 271 |
(r"(?:palee|paale|pale|pali)\b", " palais "),
|
| 272 |
+
# « pala dee » : Palais entendu en deux morceaux.
|
| 273 |
+
(r"\bpala(?:\s+d?ee?)?\b", " palais "),
|
| 274 |
(r"meddina\b", " medina "),
|
| 275 |
# whisper-small entend « liberation » pour « Liberté ».
|
| 276 |
(r"\bliberation\b", " liberte "),
|
|
|
|
| 307 |
|
| 308 |
# Construit après _sans_accents : une liste comprehendue au niveau du module est
|
| 309 |
# évaluée immédiatement, elle a besoin de la fonction déjà définie.
|
| 310 |
+
def _cible(lieu: str) -> str:
|
| 311 |
+
"""Forme de comparaison d'un lieu : comme la phrase, sans accents ni tirets."""
|
| 312 |
+
return re.sub(r"\s+", " ", re.sub(r"[^a-z0-9\s]", " ", _sans_accents(lieu))).strip()
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
_CIBLES = [(_cible(lieu), lieu) for lieu in LIEUX] + [
|
| 316 |
+
(_cible(lieu), lieu) for lieu in LIEUX_SUPPLEMENTAIRES
|
| 317 |
]
|
| 318 |
|
| 319 |
|
|
|
|
| 355 |
"fa", "wax", "nga", "ngay", "jem", "dafa", "def", "bus", "bi", "yi", "mu", "ak",
|
| 356 |
"de", "deu", "dee", "dawal", "jel", "jeel", "won", "ana", "fan", "fu",
|
| 357 |
}
|
| 358 |
+
# Premiers mots de nombreux arrêts : seuls, ils ne désignent aucun lieu
|
| 359 |
+
# (« marché liberté cinq » ne doit pas devenir « Marché aux Poissons »).
|
| 360 |
+
MOTS_TROP_VAGUES = {
|
| 361 |
+
"marche", "cite", "lycee", "hopital", "police", "poste", "ecole", "stade", "gare",
|
| 362 |
+
"rond", "point", "station", "grand", "route", "place", "croisement", "terminus",
|
| 363 |
+
"pont", "eglise", "college", "arret", "village", "quartier", "camp", "keur",
|
| 364 |
+
}
|
| 365 |
|
| 366 |
|
| 367 |
def _chercher_lieux(mots: list[str]) -> list[tuple[int, int, str]]:
|
|
|
|
| 372 |
candidats: list[tuple[float, int, int, str]] = []
|
| 373 |
for taille in range(1, TAILLE_NGRAMMES + 1):
|
| 374 |
for debut in range(len(mots) - taille + 1):
|
| 375 |
+
morceau = mots[debut : debut + taille]
|
| 376 |
+
if any(mot in MOTS_DE_LA_PHRASE for mot in morceau):
|
| 377 |
+
continue
|
| 378 |
+
if taille == 1 and morceau[0] in MOTS_TROP_VAGUES:
|
| 379 |
continue
|
| 380 |
+
gramme = " ".join(morceau)
|
| 381 |
if len(gramme) < LONGUEUR_MIN:
|
| 382 |
continue
|
| 383 |
for lieu_normalise, lieu_exact in _CIBLES:
|
src/matching/lieux.py
CHANGED
|
@@ -23,26 +23,35 @@ MOTS_GENERIQUES = {
|
|
| 23 |
|
| 24 |
ABREVIATIONS = {
|
| 25 |
"gd": "grand", "rte": "route", "av": "avenue", "bld": "boulevard", "bd": "boulevard",
|
| 26 |
-
"rd": "rond", "pt": "point", "st": "saint", "ste": "sainte",
|
| 27 |
}
|
| 28 |
|
| 29 |
CHIFFRES_ROMAINS = {"i": "1", "ii": "2", "iii": "3", "iv": "4", "v": "5", "vi": "6"}
|
| 30 |
# Le chiffre romain n'est converti qu'après ces mots : « V » seul ne veut rien dire.
|
| 31 |
AVANT_NUMERO = {"liberte", "hamo", "unite", "unites", "jaxaay", "gorom", "palais"}
|
| 32 |
|
| 33 |
-
# Surnoms et formes courantes qui ne se déduisent pas de l'orthographe.
|
|
|
|
| 34 |
ALIAS = {
|
| 35 |
"leclerc": "place leclerc",
|
| 36 |
"ucad": "universite cheikh anta diop",
|
| 37 |
"universite": "universite cheikh anta diop",
|
| 38 |
"stade lss": "stade leopold sedar senghor",
|
|
|
|
| 39 |
"aeroport lss": "aeroport",
|
| 40 |
"aeroport l s senghor": "aeroport",
|
| 41 |
"aeroport leopold sedar senghor": "aeroport",
|
| 42 |
"kharyalla": "khar yalla",
|
| 43 |
-
"
|
| 44 |
-
"
|
| 45 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
}
|
| 47 |
|
| 48 |
|
|
@@ -51,18 +60,6 @@ def sans_accents(texte: str) -> str:
|
|
| 51 |
return "".join(c for c in texte if unicodedata.category(c) != "Mn")
|
| 52 |
|
| 53 |
|
| 54 |
-
@lru_cache(maxsize=8192)
|
| 55 |
-
def _jetons(texte: str) -> tuple[str, ...]:
|
| 56 |
-
return tuple(_calcul_jetons(texte))
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
def jetons(texte: str) -> list[str]:
|
| 60 |
-
"""Mots significatifs d'un nom de lieu, dans l'ordre (alias résolus)."""
|
| 61 |
-
base = _jetons(str(texte))
|
| 62 |
-
alias = ALIAS.get(" ".join(base))
|
| 63 |
-
return list(_jetons(alias)) if alias else list(base)
|
| 64 |
-
|
| 65 |
-
|
| 66 |
def _calcul_jetons(texte: str) -> list[str]:
|
| 67 |
brut = re.sub(r"[^a-z0-9]+", " ", sans_accents(texte)).split()
|
| 68 |
sortie: list[str] = []
|
|
@@ -74,6 +71,18 @@ def _calcul_jetons(texte: str) -> list[str]:
|
|
| 74 |
return [m for m in sortie if m not in MOTS_GENERIQUES]
|
| 75 |
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
def forme(texte: str) -> str:
|
| 78 |
"""Forme de travail d'un lieu : jetons significatifs joints par des espaces."""
|
| 79 |
return " ".join(jetons(texte))
|
|
@@ -88,6 +97,21 @@ def _proches(a: str, b: str) -> bool:
|
|
| 88 |
return SequenceMatcher(None, a, b).ratio() >= 0.85
|
| 89 |
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
def score(requete: str, arret: str) -> float:
|
| 92 |
"""Ressemblance entre un lieu demandé et un arrêt, entre 0 et 1.
|
| 93 |
|
|
@@ -99,40 +123,14 @@ def score(requete: str, arret: str) -> float:
|
|
| 99 |
s = jetons(arret)
|
| 100 |
if not q or not s:
|
| 101 |
return 0.0
|
|
|
|
| 102 |
# Une rue ou une route qui porte le nom d'un quartier (« Route de Rufisque »)
|
| 103 |
# n'est pas ce quartier : on la note moins bien qu'un vrai arrêt.
|
| 104 |
-
brut = _score_brut_t(tuple(q), tuple(s))
|
| 105 |
if s[0] in VOIES and q[0] not in VOIES:
|
| 106 |
return 0.7 * brut
|
| 107 |
return brut
|
| 108 |
|
| 109 |
|
| 110 |
-
VOIES = {
|
| 111 |
-
"rue", "rues", "avenue", "boulevard", "route", "autoroute", "rocade", "allees",
|
| 112 |
-
"echangeur", "branche", "voie", "voies", "canal", "piste", "ancienne", "prolongement",
|
| 113 |
-
"retour", "sortie", "peage", "virage", "passage",
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
@lru_cache(maxsize=65536)
|
| 118 |
-
def _score_brut_t(q: tuple[str, ...], s: tuple[str, ...]) -> float:
|
| 119 |
-
return _score_brut(list(q), list(s))
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
def _score_brut(q: list[str], s: list[str]) -> float:
|
| 123 |
-
if q == s:
|
| 124 |
-
return 1.0
|
| 125 |
-
if all(mot in s for mot in q):
|
| 126 |
-
return 0.5 + 0.5 * len(q) / len(s)
|
| 127 |
-
if all(any(_proches(mot, m) for m in s) for mot in q):
|
| 128 |
-
return 0.45 + 0.45 * len(q) / len(s)
|
| 129 |
-
# Mots collés par l'ASR ou l'opérateur : « kharyalla », « taliboubess ».
|
| 130 |
-
colle_q, colle_s = "".join(q), "".join(s)
|
| 131 |
-
if len(colle_q) >= 5 and colle_q in colle_s:
|
| 132 |
-
return 0.45 + 0.45 * len(colle_q) / len(colle_s)
|
| 133 |
-
return 0.0
|
| 134 |
-
|
| 135 |
-
|
| 136 |
# --------------------------------------------------------------------------- #
|
| 137 |
# Affichage
|
| 138 |
# --------------------------------------------------------------------------- #
|
|
@@ -148,11 +146,11 @@ ACCENTS = {
|
|
| 148 |
"sebikhotane": "Sébikotane", "sebikotane": "Sébikotane", "mbedou": "Mbédou",
|
| 149 |
"allees": "Allées", "peage": "Péage", "securite": "Sécurité", "entree": "Entrée",
|
| 150 |
"maraichers": "Maraîchers", "cimetiere": "Cimetière", "etage": "Étage",
|
| 151 |
-
"penitence": "Pénitence", "
|
| 152 |
-
"
|
| 153 |
-
"
|
| 154 |
-
"
|
| 155 |
-
"
|
| 156 |
}
|
| 157 |
MAJUSCULES = {
|
| 158 |
"hlm", "ucad", "lss", "sips", "sde", "mtoa", "apix", "scoa", "seras", "capa", "rts",
|
|
@@ -170,22 +168,21 @@ def joli(nom: str) -> str:
|
|
| 170 |
mots = []
|
| 171 |
for i, mot in enumerate(texte.split()):
|
| 172 |
bas = mot.lower()
|
| 173 |
-
|
| 174 |
-
if bas.
|
| 175 |
-
|
| 176 |
-
|
|
|
|
|
|
|
|
|
|
| 177 |
elif cle in MAJUSCULES:
|
| 178 |
mots.append(mot.upper())
|
| 179 |
elif i > 0 and cle in MINUSCULES:
|
| 180 |
mots.append(bas)
|
| 181 |
elif cle in ACCENTS:
|
| 182 |
-
prefixe = "(" if bas.startswith("(") else ""
|
| 183 |
-
suffixe = ")" if bas.endswith(")") else ""
|
| 184 |
mots.append(prefixe + ACCENTS[cle] + suffixe)
|
| 185 |
else:
|
| 186 |
-
prefixe
|
| 187 |
-
corps = bas[len(prefixe):]
|
| 188 |
-
mots.append(prefixe + "-".join(p[:1].upper() + p[1:] for p in corps.split("-")))
|
| 189 |
return " ".join(mots)
|
| 190 |
|
| 191 |
|
|
@@ -199,12 +196,11 @@ PREFIXES_RETIRABLES = re.compile(
|
|
| 199 |
re.I,
|
| 200 |
)
|
| 201 |
|
| 202 |
-
|
| 203 |
# Morceaux d'itinéraire qui ne sont pas des lieux qu'on demande.
|
| 204 |
BRUIT = {
|
| 205 |
"par bassin retention", "face autoroute", "marche", "eglise", "auto route", "r802",
|
| 206 |
-
"ue 02", "par station titan", "dakar", "port", "corniche", "g dakar",
|
| 207 |
-
"pharmicie abdourahmane", "toure",
|
| 208 |
}
|
| 209 |
|
| 210 |
|
|
|
|
| 23 |
|
| 24 |
ABREVIATIONS = {
|
| 25 |
"gd": "grand", "rte": "route", "av": "avenue", "bld": "boulevard", "bd": "boulevard",
|
| 26 |
+
"rd": "rond", "pt": "point", "st": "saint", "ste": "sainte",
|
| 27 |
}
|
| 28 |
|
| 29 |
CHIFFRES_ROMAINS = {"i": "1", "ii": "2", "iii": "3", "iv": "4", "v": "5", "vi": "6"}
|
| 30 |
# Le chiffre romain n'est converti qu'après ces mots : « V » seul ne veut rien dire.
|
| 31 |
AVANT_NUMERO = {"liberte", "hamo", "unite", "unites", "jaxaay", "gorom", "palais"}
|
| 32 |
|
| 33 |
+
# Surnoms et formes courantes qui ne se déduisent pas de l'orthographe. Les deux
|
| 34 |
+
# côtés de la comparaison passent par cette table.
|
| 35 |
ALIAS = {
|
| 36 |
"leclerc": "place leclerc",
|
| 37 |
"ucad": "universite cheikh anta diop",
|
| 38 |
"universite": "universite cheikh anta diop",
|
| 39 |
"stade lss": "stade leopold sedar senghor",
|
| 40 |
+
"stade l s s": "stade leopold sedar senghor",
|
| 41 |
"aeroport lss": "aeroport",
|
| 42 |
"aeroport l s senghor": "aeroport",
|
| 43 |
"aeroport leopold sedar senghor": "aeroport",
|
| 44 |
"kharyalla": "khar yalla",
|
| 45 |
+
"sacree coeur": "sacre coeur",
|
| 46 |
+
"pattesd oie": "patte d oie",
|
| 47 |
+
"lat dior": "lat dior",
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
# Premiers mots d'une voie : « Route de Rufisque » n'est pas Rufisque.
|
| 51 |
+
VOIES = {
|
| 52 |
+
"rue", "rues", "avenue", "boulevard", "route", "autoroute", "rocade", "allees",
|
| 53 |
+
"echangeur", "branche", "voie", "voies", "canal", "piste", "ancienne", "prolongement",
|
| 54 |
+
"retour", "sortie", "peage", "virage", "passage",
|
| 55 |
}
|
| 56 |
|
| 57 |
|
|
|
|
| 60 |
return "".join(c for c in texte if unicodedata.category(c) != "Mn")
|
| 61 |
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
def _calcul_jetons(texte: str) -> list[str]:
|
| 64 |
brut = re.sub(r"[^a-z0-9]+", " ", sans_accents(texte)).split()
|
| 65 |
sortie: list[str] = []
|
|
|
|
| 71 |
return [m for m in sortie if m not in MOTS_GENERIQUES]
|
| 72 |
|
| 73 |
|
| 74 |
+
@lru_cache(maxsize=16384)
|
| 75 |
+
def _jetons(texte: str) -> tuple[str, ...]:
|
| 76 |
+
return tuple(_calcul_jetons(texte))
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def jetons(texte: str) -> list[str]:
|
| 80 |
+
"""Mots significatifs d'un nom de lieu, dans l'ordre (alias résolus)."""
|
| 81 |
+
base = _jetons(str(texte))
|
| 82 |
+
alias = ALIAS.get(" ".join(base))
|
| 83 |
+
return list(_jetons(alias)) if alias else list(base)
|
| 84 |
+
|
| 85 |
+
|
| 86 |
def forme(texte: str) -> str:
|
| 87 |
"""Forme de travail d'un lieu : jetons significatifs joints par des espaces."""
|
| 88 |
return " ".join(jetons(texte))
|
|
|
|
| 97 |
return SequenceMatcher(None, a, b).ratio() >= 0.85
|
| 98 |
|
| 99 |
|
| 100 |
+
@lru_cache(maxsize=131072)
|
| 101 |
+
def _score_brut(q: tuple[str, ...], s: tuple[str, ...]) -> float:
|
| 102 |
+
if q == s:
|
| 103 |
+
return 1.0
|
| 104 |
+
if all(mot in s for mot in q):
|
| 105 |
+
return 0.5 + 0.5 * len(q) / len(s)
|
| 106 |
+
if all(any(_proches(mot, m) for m in s) for mot in q):
|
| 107 |
+
return 0.45 + 0.45 * len(q) / len(s)
|
| 108 |
+
# Mots collés par l'ASR ou l'opérateur : « kharyalla », « taliboubess ».
|
| 109 |
+
colle_q, colle_s = "".join(q), "".join(s)
|
| 110 |
+
if len(colle_q) >= 5 and colle_q in colle_s:
|
| 111 |
+
return 0.45 + 0.45 * len(colle_q) / len(colle_s)
|
| 112 |
+
return 0.0
|
| 113 |
+
|
| 114 |
+
|
| 115 |
def score(requete: str, arret: str) -> float:
|
| 116 |
"""Ressemblance entre un lieu demandé et un arrêt, entre 0 et 1.
|
| 117 |
|
|
|
|
| 123 |
s = jetons(arret)
|
| 124 |
if not q or not s:
|
| 125 |
return 0.0
|
| 126 |
+
brut = _score_brut(tuple(q), tuple(s))
|
| 127 |
# Une rue ou une route qui porte le nom d'un quartier (« Route de Rufisque »)
|
| 128 |
# n'est pas ce quartier : on la note moins bien qu'un vrai arrêt.
|
|
|
|
| 129 |
if s[0] in VOIES and q[0] not in VOIES:
|
| 130 |
return 0.7 * brut
|
| 131 |
return brut
|
| 132 |
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
# --------------------------------------------------------------------------- #
|
| 135 |
# Affichage
|
| 136 |
# --------------------------------------------------------------------------- #
|
|
|
|
| 146 |
"sebikhotane": "Sébikotane", "sebikotane": "Sébikotane", "mbedou": "Mbédou",
|
| 147 |
"allees": "Allées", "peage": "Péage", "securite": "Sécurité", "entree": "Entrée",
|
| 148 |
"maraichers": "Maraîchers", "cimetiere": "Cimetière", "etage": "Étage",
|
| 149 |
+
"penitence": "Pénitence", "sacree": "Sacré", "sacre": "Sacré", "coeur": "Cœur",
|
| 150 |
+
"hotel": "Hôtel", "routiere": "routière", "mole": "Môle", "prolongee": "Prolongée",
|
| 151 |
+
"tapee": "Tapée", "unites": "Unités", "unite": "Unité", "general": "Général",
|
| 152 |
+
"degagement": "Dégagement", "tilene": "Tilène", "cinema": "Cinéma",
|
| 153 |
+
"aere": "Aéré", "hygiene": "Hygiène", "obelisque": "Obélisque", "siege": "Siège",
|
| 154 |
}
|
| 155 |
MAJUSCULES = {
|
| 156 |
"hlm", "ucad", "lss", "sips", "sde", "mtoa", "apix", "scoa", "seras", "capa", "rts",
|
|
|
|
| 168 |
mots = []
|
| 169 |
for i, mot in enumerate(texte.split()):
|
| 170 |
bas = mot.lower()
|
| 171 |
+
prefixe = "(" if bas.startswith("(") else ""
|
| 172 |
+
suffixe = ")" if bas.endswith(")") else ""
|
| 173 |
+
corps = bas.strip("()")
|
| 174 |
+
cle = sans_accents(corps).strip("'.,")
|
| 175 |
+
if corps.startswith(("d'", "l'")):
|
| 176 |
+
reste = corps[2:]
|
| 177 |
+
mots.append(prefixe + corps[:2] + ACCENTS.get(sans_accents(reste), reste.capitalize()) + suffixe)
|
| 178 |
elif cle in MAJUSCULES:
|
| 179 |
mots.append(mot.upper())
|
| 180 |
elif i > 0 and cle in MINUSCULES:
|
| 181 |
mots.append(bas)
|
| 182 |
elif cle in ACCENTS:
|
|
|
|
|
|
|
| 183 |
mots.append(prefixe + ACCENTS[cle] + suffixe)
|
| 184 |
else:
|
| 185 |
+
mots.append(prefixe + "-".join(p[:1].upper() + p[1:] for p in corps.split("-")) + suffixe)
|
|
|
|
|
|
|
| 186 |
return " ".join(mots)
|
| 187 |
|
| 188 |
|
|
|
|
| 196 |
re.I,
|
| 197 |
)
|
| 198 |
|
|
|
|
| 199 |
# Morceaux d'itinéraire qui ne sont pas des lieux qu'on demande.
|
| 200 |
BRUIT = {
|
| 201 |
"par bassin retention", "face autoroute", "marche", "eglise", "auto route", "r802",
|
| 202 |
+
"ue 02", "par station titan", "dakar", "port", "corniche", "g dakar",
|
| 203 |
+
"derriere hopital dalal diam", "pharmicie abdourahmane", "toure",
|
| 204 |
}
|
| 205 |
|
| 206 |
|
src/matching/stops_matcher.py
CHANGED
|
@@ -5,8 +5,9 @@ data/itineraires_dakar.csv (arrêts de chaque ligne, dans l'ordre), construits
|
|
| 5 |
par data/sources/build_dataset.py.
|
| 6 |
|
| 7 |
Une ligne convient si l'un de ses arrêts correspond au départ et un autre à
|
| 8 |
-
l'arrivée :
|
| 9 |
-
déduit de l'ordre des arrêts.
|
|
|
|
| 10 |
"""
|
| 11 |
|
| 12 |
from __future__ import annotations
|
|
@@ -14,10 +15,10 @@ from __future__ import annotations
|
|
| 14 |
import csv
|
| 15 |
from pathlib import Path
|
| 16 |
|
| 17 |
-
try: # import à plat (app.py, Streamlit) ou en paquet
|
| 18 |
-
from matching.lieux import score
|
| 19 |
except ImportError: # pragma: no cover
|
| 20 |
-
from .lieux import score
|
| 21 |
|
| 22 |
DATA = Path(__file__).resolve().parents[2] / "data"
|
| 23 |
LIGNES_CSV = DATA / "lignes_dakar.csv"
|
|
@@ -30,6 +31,7 @@ MIN_SCORE = 0.6
|
|
| 30 |
# les lignes qui ne passent qu'à « Grand Yoff ».
|
| 31 |
TOLERANCE = 0.15
|
| 32 |
MAX_LIGNES = 4
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
class StopsMatcher:
|
|
@@ -43,6 +45,12 @@ class StopsMatcher:
|
|
| 43 |
for rangee in sorted(csv.DictReader(f), key=lambda r: int(r["ordre"])):
|
| 44 |
self.arrets.setdefault((rangee["compagnie"], rangee["ligne"]), []).append(rangee["arret"])
|
| 45 |
self.tous_les_arrets = sorted({a for arrets in self.arrets.values() for a in arrets})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
# ------------------------------------------------------------------ #
|
| 48 |
|
|
@@ -65,15 +73,87 @@ class StopsMatcher:
|
|
| 65 |
meilleur = (arret, valeur)
|
| 66 |
return meilleur
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
def find_line(self, depart: str, arrivee: str) -> dict:
|
| 69 |
"""Lignes reliant depart et arrivee, la meilleure en tête.
|
| 70 |
|
| 71 |
Chaque ligne renvoyée porte : compagnie, ligne, categorie, depart et
|
| 72 |
arrivee (les terminus dans le sens du trajet), sens, monte_a et
|
| 73 |
-
descend_a (les arrêts où monter et descendre).
|
|
|
|
| 74 |
"""
|
| 75 |
-
|
| 76 |
-
|
|
|
|
| 77 |
depart_valide = depart_score >= MIN_SCORE
|
| 78 |
arrivee_valide = arrivee_score >= MIN_SCORE
|
| 79 |
|
|
@@ -92,21 +172,11 @@ class StopsMatcher:
|
|
| 92 |
gardees = [c for c in candidates if c[0] >= meilleur - TOLERANCE]
|
| 93 |
# Meilleure correspondance d'abord, puis le trajet le plus court en arrêts.
|
| 94 |
gardees.sort(key=lambda c: (-c[0], -c[1], c[2], c[3]))
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
"compagnie": info["compagnie"],
|
| 101 |
-
"ligne": info["ligne"],
|
| 102 |
-
"categorie": info.get("categorie", ""),
|
| 103 |
-
"depart": info["terminus_a"] if direct else info["terminus_b"],
|
| 104 |
-
"arrivee": info["terminus_b"] if direct else info["terminus_a"],
|
| 105 |
-
"sens": "direct" if direct else "inverse",
|
| 106 |
-
"monte_a": arrets[i_dep],
|
| 107 |
-
"descend_a": arrets[i_arr],
|
| 108 |
-
}
|
| 109 |
-
)
|
| 110 |
|
| 111 |
return {
|
| 112 |
"found": bool(lignes),
|
|
@@ -119,4 +189,5 @@ class StopsMatcher:
|
|
| 119 |
"arrivee_score": round(arrivee_score, 3),
|
| 120 |
"arrivee_valide": arrivee_valide,
|
| 121 |
"lignes": lignes,
|
|
|
|
| 122 |
}
|
|
|
|
| 5 |
par data/sources/build_dataset.py.
|
| 6 |
|
| 7 |
Une ligne convient si l'un de ses arrêts correspond au départ et un autre à
|
| 8 |
+
l'arrivée : les deux lieux n'ont plus besoin d'être ses terminus. Le sens est
|
| 9 |
+
déduit de l'ordre des arrêts. Sans ligne directe, on cherche un trajet avec une
|
| 10 |
+
correspondance : deux lignes qui passent par un même arrêt.
|
| 11 |
"""
|
| 12 |
|
| 13 |
from __future__ import annotations
|
|
|
|
| 15 |
import csv
|
| 16 |
from pathlib import Path
|
| 17 |
|
| 18 |
+
try: # import à plat (app.py, Streamlit) ou en paquet
|
| 19 |
+
from matching.lieux import VOIES, forme, jetons, score
|
| 20 |
except ImportError: # pragma: no cover
|
| 21 |
+
from .lieux import VOIES, forme, jetons, score
|
| 22 |
|
| 23 |
DATA = Path(__file__).resolve().parents[2] / "data"
|
| 24 |
LIGNES_CSV = DATA / "lignes_dakar.csv"
|
|
|
|
| 31 |
# les lignes qui ne passent qu'à « Grand Yoff ».
|
| 32 |
TOLERANCE = 0.15
|
| 33 |
MAX_LIGNES = 4
|
| 34 |
+
MAX_CORRESPONDANCES = 3
|
| 35 |
|
| 36 |
|
| 37 |
class StopsMatcher:
|
|
|
|
| 45 |
for rangee in sorted(csv.DictReader(f), key=lambda r: int(r["ordre"])):
|
| 46 |
self.arrets.setdefault((rangee["compagnie"], rangee["ligne"]), []).append(rangee["arret"])
|
| 47 |
self.tous_les_arrets = sorted({a for arrets in self.arrets.values() for a in arrets})
|
| 48 |
+
# Pour les correspondances : la forme de chaque arrêt, sans les voies
|
| 49 |
+
# (on ne change pas de bus « sur l'autoroute »).
|
| 50 |
+
self.formes: dict[tuple[str, str], list[str]] = {
|
| 51 |
+
cle: [forme(a) if (jetons(a) and jetons(a)[0] not in VOIES) else "" for a in arrets]
|
| 52 |
+
for cle, arrets in self.arrets.items()
|
| 53 |
+
}
|
| 54 |
|
| 55 |
# ------------------------------------------------------------------ #
|
| 56 |
|
|
|
|
| 73 |
meilleur = (arret, valeur)
|
| 74 |
return meilleur
|
| 75 |
|
| 76 |
+
def _troncon(self, cle: tuple[str, str], i_dep: int, i_arr: int) -> dict:
|
| 77 |
+
"""Une ligne parcourue de l'arrêt i_dep à l'arrêt i_arr."""
|
| 78 |
+
info, arrets = self.lignes[cle], self.arrets[cle]
|
| 79 |
+
direct = i_dep < i_arr
|
| 80 |
+
return {
|
| 81 |
+
"compagnie": info["compagnie"],
|
| 82 |
+
"ligne": info["ligne"],
|
| 83 |
+
"categorie": info.get("categorie", ""),
|
| 84 |
+
"depart": info["terminus_a"] if direct else info["terminus_b"],
|
| 85 |
+
"arrivee": info["terminus_b"] if direct else info["terminus_a"],
|
| 86 |
+
"sens": "direct" if direct else "inverse",
|
| 87 |
+
"monte_a": arrets[i_dep],
|
| 88 |
+
"descend_a": arrets[i_arr],
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
def _correspondances(self, depart: str, arrivee: str) -> list[dict]:
|
| 92 |
+
"""Trajets en deux bus quand aucune ligne ne relie directement les deux lieux."""
|
| 93 |
+
cotes_dep, cotes_arr = [], []
|
| 94 |
+
for cle, arrets in self.arrets.items():
|
| 95 |
+
s, i = self._meilleur(depart, arrets)
|
| 96 |
+
if s >= MIN_SCORE:
|
| 97 |
+
cotes_dep.append((s, cle, i))
|
| 98 |
+
s, i = self._meilleur(arrivee, arrets)
|
| 99 |
+
if s >= MIN_SCORE:
|
| 100 |
+
cotes_arr.append((s, cle, i))
|
| 101 |
+
if not cotes_dep or not cotes_arr:
|
| 102 |
+
return []
|
| 103 |
+
seuil_dep = max(c[0] for c in cotes_dep) - TOLERANCE
|
| 104 |
+
seuil_arr = max(c[0] for c in cotes_arr) - TOLERANCE
|
| 105 |
+
|
| 106 |
+
trajets = []
|
| 107 |
+
for s_dep, cle_a, i_dep in cotes_dep:
|
| 108 |
+
if s_dep < seuil_dep:
|
| 109 |
+
continue
|
| 110 |
+
for s_arr, cle_b, i_arr in cotes_arr:
|
| 111 |
+
if s_arr < seuil_arr or cle_a == cle_b:
|
| 112 |
+
continue
|
| 113 |
+
positions_b: dict[str, int] = {}
|
| 114 |
+
for j, f in enumerate(self.formes[cle_b]):
|
| 115 |
+
if f and j != i_arr:
|
| 116 |
+
positions_b.setdefault(f, j)
|
| 117 |
+
meilleur = None
|
| 118 |
+
for x, f in enumerate(self.formes[cle_a]):
|
| 119 |
+
if not f or x == i_dep or f not in positions_b:
|
| 120 |
+
continue
|
| 121 |
+
y = positions_b[f]
|
| 122 |
+
cout = abs(x - i_dep) + abs(i_arr - y)
|
| 123 |
+
if meilleur is None or cout < meilleur[0]:
|
| 124 |
+
meilleur = (cout, x, y)
|
| 125 |
+
if meilleur:
|
| 126 |
+
cout, x, y = meilleur
|
| 127 |
+
trajets.append(
|
| 128 |
+
(-(s_dep + s_arr), cout, cle_a, cle_b, {
|
| 129 |
+
"etape_1": self._troncon(cle_a, i_dep, x),
|
| 130 |
+
"etape_2": self._troncon(cle_b, y, i_arr),
|
| 131 |
+
"changement": self.arrets[cle_a][x],
|
| 132 |
+
})
|
| 133 |
+
)
|
| 134 |
+
trajets.sort(key=lambda t: t[:4])
|
| 135 |
+
sortie, vus = [], set()
|
| 136 |
+
for *_, trajet in trajets:
|
| 137 |
+
cle = (trajet["etape_1"]["ligne"], trajet["etape_1"]["compagnie"],
|
| 138 |
+
trajet["etape_2"]["ligne"], trajet["etape_2"]["compagnie"])
|
| 139 |
+
if cle not in vus:
|
| 140 |
+
vus.add(cle)
|
| 141 |
+
sortie.append(trajet)
|
| 142 |
+
if len(sortie) == MAX_CORRESPONDANCES:
|
| 143 |
+
break
|
| 144 |
+
return sortie
|
| 145 |
+
|
| 146 |
def find_line(self, depart: str, arrivee: str) -> dict:
|
| 147 |
"""Lignes reliant depart et arrivee, la meilleure en tête.
|
| 148 |
|
| 149 |
Chaque ligne renvoyée porte : compagnie, ligne, categorie, depart et
|
| 150 |
arrivee (les terminus dans le sens du trajet), sens, monte_a et
|
| 151 |
+
descend_a (les arrêts où monter et descendre). Sans ligne directe,
|
| 152 |
+
« correspondances » propose des trajets en deux bus.
|
| 153 |
"""
|
| 154 |
+
depart, arrivee = depart or "", arrivee or ""
|
| 155 |
+
depart_arret, depart_score = self._reconnu(depart)
|
| 156 |
+
arrivee_arret, arrivee_score = self._reconnu(arrivee)
|
| 157 |
depart_valide = depart_score >= MIN_SCORE
|
| 158 |
arrivee_valide = arrivee_score >= MIN_SCORE
|
| 159 |
|
|
|
|
| 172 |
gardees = [c for c in candidates if c[0] >= meilleur - TOLERANCE]
|
| 173 |
# Meilleure correspondance d'abord, puis le trajet le plus court en arrêts.
|
| 174 |
gardees.sort(key=lambda c: (-c[0], -c[1], c[2], c[3]))
|
| 175 |
+
lignes = [self._troncon(cle, i_dep, i_arr) for *_, cle, i_dep, i_arr in gardees[:MAX_LIGNES]]
|
| 176 |
+
|
| 177 |
+
correspondances = []
|
| 178 |
+
if not lignes and depart_valide and arrivee_valide:
|
| 179 |
+
correspondances = self._correspondances(depart, arrivee)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
return {
|
| 182 |
"found": bool(lignes),
|
|
|
|
| 189 |
"arrivee_score": round(arrivee_score, 3),
|
| 190 |
"arrivee_valide": arrivee_valide,
|
| 191 |
"lignes": lignes,
|
| 192 |
+
"correspondances": correspondances,
|
| 193 |
}
|
src/tts/pregenerer.py
CHANGED
|
@@ -20,7 +20,7 @@ import time
|
|
| 20 |
from pathlib import Path
|
| 21 |
|
| 22 |
RACINE = Path(__file__).resolve().parents[2]
|
| 23 |
-
CSV_LIGNES = RACINE / "data" / "
|
| 24 |
|
| 25 |
sys.path.insert(0, str(RACINE / "src"))
|
| 26 |
|
|
@@ -46,10 +46,12 @@ PHRASES_SERVICE = [
|
|
| 46 |
|
| 47 |
def couples_du_csv() -> list[tuple[str, int]]:
|
| 48 |
"""Tous les couples (compagnie, numéro) du jeu de données, sans doublon."""
|
| 49 |
-
import
|
| 50 |
|
| 51 |
couples = set()
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
numero = numero_de(record.get("ligne"))
|
| 54 |
if numero is not None:
|
| 55 |
couples.add((str(record.get("compagnie", "")).strip(), numero))
|
|
|
|
| 20 |
from pathlib import Path
|
| 21 |
|
| 22 |
RACINE = Path(__file__).resolve().parents[2]
|
| 23 |
+
CSV_LIGNES = RACINE / "data" / "lignes_dakar.csv"
|
| 24 |
|
| 25 |
sys.path.insert(0, str(RACINE / "src"))
|
| 26 |
|
|
|
|
| 46 |
|
| 47 |
def couples_du_csv() -> list[tuple[str, int]]:
|
| 48 |
"""Tous les couples (compagnie, numéro) du jeu de données, sans doublon."""
|
| 49 |
+
import csv
|
| 50 |
|
| 51 |
couples = set()
|
| 52 |
+
with open(CSV_LIGNES, newline="", encoding="utf-8") as fichier:
|
| 53 |
+
records = list(csv.DictReader(fichier))
|
| 54 |
+
for record in records:
|
| 55 |
numero = numero_de(record.get("ligne"))
|
| 56 |
if numero is not None:
|
| 57 |
couples.add((str(record.get("compagnie", "")).strip(), numero))
|