changement de format du dictionnaire

This commit is contained in:
Adrien MALINGREY 2025-05-08 05:21:07 +02:00
parent ffe308ba3e
commit 2e93e2c878
2 changed files with 2829 additions and 4019 deletions

6614
dico.csv

File diff suppressed because it is too large Load Diff

View File

@ -22,18 +22,14 @@ function dico($longueur_max) {
|| strlen($ligne[0]) > $longueur_max || strlen($ligne[0]) > $longueur_max
) continue; ) continue;
switch(count($ligne)) { $mot = $ligne[0];
case 1: $definitions = array_slice($ligne, 1);
[$mot] = $ligne;
$definition = ""; foreach ($definitions as $i => $definition) {
break; if (strpos($definition, "@") !== false) {
case 2: [$definition, $auteur] = explode("@", $definition);
[$mot, $definition] = $ligne; $definitions[$i] = "$definition <small><em>$auteur</em></small>";
break; }
case 3:
[$mot, $definition, $auteur] = $ligne;
$definition .= " <small><em>$auteur</em></small>";
break;
} }
$mot = str_replace("-", " ", $mot); $mot = str_replace("-", " ", $mot);
@ -42,12 +38,10 @@ function dico($longueur_max) {
$mots = explode(" ", $mot); $mots = explode(" ", $mot);
$nb_mots = count($mots); $nb_mots = count($mots);
$mot = implode("", $mots); $mot = implode("", $mots);
$definition .= " ($nb_mots mots)"; $definition .= " <small>($nb_mots mots)</small>";
} }
$longueur = strlen($mot); $dico[strlen($mot)][$mot] = $definitions;
if (!isset($dico[$longueur][$mot])) $dico[$longueur][$mot] = [];
if (strlen($definition)) $dico[$longueur][$mot][] = $definition;
} }
fclose($lecteur); fclose($lecteur);
} }