Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 131d8f89 authored by Sylvain Hatier's avatar Sylvain Hatier Committed by Arnaud Bey
Browse files

Trim import lexique

parent 9cd7d5c9
...@@ -161,7 +161,7 @@ class ImportManager ...@@ -161,7 +161,7 @@ class ImportManager
#mb_eregi_replace ? #mb_eregi_replace ?
$cleanWordValue = str_replace($specs["rewriteFrom"], $specs["rewriteTo"], $wordValue); $cleanWordValue = str_replace($specs["rewriteFrom"], $specs["rewriteTo"], $wordValue);
// $cleanWordValue = preg_replace($specs["rewriteFrom"], $specs["rewriteTo"], $wordValue); // $cleanWordValue = preg_replace($specs["rewriteFrom"], $specs["rewriteTo"], $wordValue);
$cleanWordValue = trim($cleanWordValue);
$string2print="ROOT = ".$rootValue." / CLEAN = ".$cleanWordValue; $string2print="ROOT = ".$rootValue." / CLEAN = ".$cleanWordValue;
//$cleanWordValue = preg_replace("/\P{L}/", "", $cleanWordValue);#bug pour le russe //$cleanWordValue = preg_replace("/\P{L}/", "", $cleanWordValue);#bug pour le russe
$cleanWordValue = mb_eregi_replace("/\P{L}/", "", $cleanWordValue);#fonctionne pour le russe $cleanWordValue = mb_eregi_replace("/\P{L}/", "", $cleanWordValue);#fonctionne pour le russe
...@@ -181,7 +181,7 @@ class ImportManager ...@@ -181,7 +181,7 @@ class ImportManager
$features = []; $features = [];
foreach ($labelsNValues as $labelNValue) { foreach ($labelsNValues as $labelNValue) {
$featureStringTab = explode("=", $labelNValue); $featureStringTab = explode("=", $labelNValue);
$features[] = $this->fm->findOrCreate($language, $featureStringTab[0], $featureStringTab[1], $featuresToFlush); $features[] = $this->fm->findOrCreate($language, trim($featureStringTab[0]), trim($featureStringTab[1]), $featuresToFlush);
} }
// WORD // WORD
...@@ -201,7 +201,7 @@ class ImportManager ...@@ -201,7 +201,7 @@ class ImportManager
//Gestion des $bigram //Gestion des $bigram
if ($previousLetter != "") { if ($previousLetter != "") {
$bigramString = $previousLetter.$wordLetter; $bigramString = $previousLetter.$wordLetter;
$bigrams[$bigramString] = !array_key_exists($bigramString, $bigrams) ? 1 : $bigrams[$bigramString] + 1; $bigrams[trim($bigramString)] = !array_key_exists($bigramString, $bigrams) ? 1 : $bigrams[$bigramString] + 1;
} }
$previousLetter = $wordLetter; $previousLetter = $wordLetter;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment