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 50fe8352 authored by Sylvain Hatier's avatar Sylvain Hatier Committed by Arnaud Bey
Browse files

Filtre Mots entre 2 et 16 lettres

parent b8e9422a
......@@ -152,22 +152,27 @@ class ImportManager
$handle = @fopen($pathFileLexicon, "r");
if ($handle) {
while (($line = fgets($handle, 4096)) !== false) {
if ($flushCpt !== 0) {
if (preg_match_all("/^([^\t]+)\t([^\t]+)\t([^\t]+)\s*$/", $line, $matches)) {
$uid1 = uniqid();
$uid2 = uniqid();
if (preg_match_all("/^([^\t]+)\t([^\t]+)\t([^\t]+)\s*$/", $line, $matches)) {
$uid1 = uniqid();
$uid2 = uniqid();
$wordValue = $matches[1][0];
$rootValue = $matches[2][0];
#mb_eregi_replace ?
$cleanWordValue = str_replace($specs["rewriteFrom"], $specs["rewriteTo"], $wordValue);
// $cleanWordValue = preg_replace($specs["rewriteFrom"], $specs["rewriteTo"], $wordValue);
$wordValue = $matches[1][0];
$rootValue = $matches[2][0];
#mb_eregi_replace ?
$cleanWordValue = str_replace($specs["rewriteFrom"], $specs["rewriteTo"], $wordValue);
// $cleanWordValue = preg_replace($specs["rewriteFrom"], $specs["rewriteTo"], $wordValue);
$string2print="ROOT = ".$rootValue." / CLEAN = ".$cleanWordValue;
//$cleanWordValue = preg_replace("/\P{L}/", "", $cleanWordValue);#bug pour le russe
$string2print="ROOT = ".$rootValue." / CLEAN = ".$cleanWordValue;
//$cleanWordValue = preg_replace("/\P{L}/", "", $cleanWordValue);#bug pour le russe
$cleanWordValue = mb_eregi_replace("/\P{L}/", "", $cleanWordValue);#fonctionne pour le russe
$string2print.=" / EREGI = ".$cleanWordValue."\n";
// SI après nettoyage, la cleanvalue contient moins de deux caractères, on passe à la ligne suivante
//
// Gestion des lettres et débuts de mots
$wordsLetters = preg_split('//u', $cleanWordValue, null, PREG_SPLIT_NO_EMPTY);
if ((count($wordsLetters)>=2) && (count($wordsLetters)<=16)) {
// ROOT
$root = $this->rm->findOrCreate($language, $rootValue, $roots);
......@@ -182,8 +187,7 @@ class ImportManager
// WORD
$this->wm->create($language, $root, $features, $wordValue, $cleanWordValue);
// Gestion des lettres et débuts de mots
$wordsLetters = preg_split('//u', $cleanWordValue, null, PREG_SPLIT_NO_EMPTY);
$wordStartString = "";
$previousLetter="";
foreach ($wordsLetters as $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