Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export all names #442

Draft
wants to merge 1 commit into
base: bano_v3
Choose a base branch
from
Draft

Conversation

frodrigo
Copy link
Member

Exporte tous les noms de voies/ld.

Pour le JSON, ça produite un tableau.

Par contre pour les autres format ce PR est à terminer.

Concernant le CSV (et les autres formats), il vaut mieux n'inclure que le premier nom ou tous ?

En pratique. Ça produite des choses comme ['Rue des Étangs', 'Rue des Etangs'] en sortie. Dans la version que je fait tourner, j'ai en plus une déduplication fuzzy.

--- a/bano/sql/tables_export.sql
+++ b/bano/sql/tables_export.sql
@@ -40,13 +40,18 @@ nom_fantoir_uniq_rank
 AS (
     SELECT
         fantoir,
-        nom,
+        (array_agg(nom ORDER BY
+            -- Pour des noms similaires, préférer la version avec diacritiques
+            regexp_count(nom, '[ÀÂÄÉÈÊËÎÏÔÖÙÛÜŸÇÆŒàâäéèêëîïôöùûüÿçæœñ]') DESC,
+            -- Pour des noms similaires, préférer la version avec minuscule
+            regexp_count(nom, '[a-zàâäéèêëîïôöùûüÿçæœñ]') DESC
+        ))[1] AS nom,
         min(rank) AS rank
     FROM
         nom_fantoir_rank
     GROUP BY
         fantoir,
-        nom
+        replace(lower(unaccent(nom)), '-', ' ')
 ),
 nom_fantoir
 AS

@frodrigo frodrigo marked this pull request as draft February 17, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant