Eviter les doublons lorsqu'il y a plusieurs mots en ligne

This commit is contained in:
2025-05-01 23:25:21 +02:00
parent b042fcd77a
commit 38344a315c
4 changed files with 73 additions and 72 deletions

View File

@ -9,7 +9,7 @@ $dico = [[]];
if (($lecteur = fopen("dico.csv", "r")) !== FALSE) {
$header = fgetcsv($lecteur, 0, "\t");
while (($ligne = fgetcsv($lecteur, 0, "\t")) !== FALSE) {
if ($ligne[0] != NULL && substr($ligne[0], 0, 1) == "#") {
if ($ligne[0] == NULL || substr($ligne[0], 0, 1) == "#") {
continue;
}
switch(count($ligne)) {
@ -33,7 +33,9 @@ if (($lecteur = fopen("dico.csv", "r")) !== FALSE) {
if (!isset($dico[$longueur][$mot])) {
$dico[$longueur][$mot] = [];
}
$dico[$longueur][$mot][] = $definition;
if (strlen($definition)) {
$dico[$longueur][$mot][] = $definition;
}
}
fclose($lecteur);
}