| Line 111... |
Line 111... |
| 111 |
}
|
111 |
}
|
| 112 |
} else {
|
112 |
} else {
|
| 113 |
$this->messages->traiterErreur("Le dossier {$this->nomDossier} est introuvable.");
|
113 |
$this->messages->traiterErreur("Le dossier {$this->nomDossier} est introuvable.");
|
| 114 |
}
|
114 |
}
|
| Line 115... |
Line 115... |
| 115 |
|
115 |
|
| 116 |
arsort($this->listeFichiers);
|
116 |
asort($this->listeFichiers);
|
| Line 117... |
Line 117... |
| 117 |
}
|
117 |
}
|
| 118 |
|
118 |
|
| 119 |
private function verifierFichier() {
|
119 |
private function verifierFichier() {
|
| Line 159... |
Line 159... |
| 159 |
$infos = $this->infosCorrespondanceBase;
|
159 |
$infos = $this->infosCorrespondanceBase;
|
| Line 160... |
Line 160... |
| 160 |
|
160 |
|
| 161 |
$titre = $donnees['titre'];
|
161 |
$titre = $donnees['titre'];
|
| 162 |
if (preg_match('/^Coste ([0-9]+) - ((?:(?! - ).)+) - F[0-9]+, (?:(?! - ).)+ - (G[0-9]+), T([123])[.]p([0-9]+)$/', $titre, $match)) {
|
162 |
if (preg_match('/^Coste ([0-9]+) - ((?:(?! - ).)+) - F[0-9]+, (?:(?! - ).)+ - (G[0-9]+), T([123])[.]p([0-9]+)$/', $titre, $match)) {
|
| - |
|
163 |
$infos['num_nom_coste'] = $match[1];
|
| 163 |
$infos['num_nom_coste'] = $match[1];
|
164 |
$infos['num_nom_retenu_coste'] = $match[1];
|
| 164 |
$infos['nom_sci'] = $match[2];
|
165 |
$infos['nom_sci'] = $match[2];
|
| 165 |
$infos['num_tax_sup_coste'] = $match[3];
|
166 |
$infos['num_tax_sup_coste'] = $match[3];
|
| 166 |
$infos['tome'] = $match[4];
|
167 |
$infos['tome'] = $match[4];
|
| 167 |
$infos['page'] = $match[5];
|
168 |
$infos['page'] = $match[5];
|
| Line 178... |
Line 179... |
| 178 |
}
|
179 |
}
|
| Line 179... |
Line 180... |
| 179 |
|
180 |
|
| 180 |
$txt = $donnees['texte'];
|
181 |
$txt = $donnees['texte'];
|
| 181 |
$txt = $this->corrigerDescription($txt);
|
182 |
$txt = $this->corrigerDescription($txt);
|
| 182 |
if (preg_match('/^<B>[0-9]{1,4}[.] – ([^<]+)<\/B> ([^–]*)– (?:<I>([^<]+)<\/I>[.] – |<I>([^<]+)<\/I>( \([^)]+\))[.] – |[A-Z]|<I>(?:Sous-|Espèce|Turion|Souche|Plante|Feuille|Racine))/u', $txt, $match)) {
|
183 |
if (preg_match('/^<B>[0-9]{1,4}[.] – ([^<]+)<\/B> ([^–]*)– (?:<I>([^<]+)<\/I>[.] – |<I>([^<]+)<\/I>( \([^)]+\))[.] – |[A-Z]|<I>(?:Sous-|Espèce|Turion|Souche|Plante|Feuille|Racine))/u', $txt, $match)) {
|
| - |
|
184 |
$infos['nom_coste'] = trim($match[1]);
|
| 183 |
$infos['nom_coste'] = trim($match[1]);
|
185 |
$infos['rang'] = $this->obtenirRangNom($infos['nom_coste']);
|
| 184 |
$infos['auteur_coste'] = trim($match[2]);
|
186 |
$infos['auteur_coste'] = trim($match[2]);
|
| 185 |
$infos['nom_francais'] = isset($match[3]) ? $match[3] : '';
|
187 |
$infos['nom_francais'] = isset($match[3]) ? $match[3] : '';
|
| 186 |
$infos['nom_francais'] = isset($match[4]) && isset($match[5]) ? $match[4].$match[5] : $infos['nom_francais'];
|
188 |
$infos['nom_francais'] = isset($match[4]) && isset($match[5]) ? $match[4].$match[5] : $infos['nom_francais'];
|
| 187 |
if (strpos($infos['auteur_coste'], '(' ) !== false) {
|
189 |
if (strpos($infos['auteur_coste'], '(' ) !== false) {
|
| Line 227... |
Line 229... |
| 227 |
|
229 |
|
| Line 228... |
Line 230... |
| 228 |
$synonymes = explode(';', $synoCoste);
|
230 |
$synonymes = explode(';', $synoCoste);
|
| 229 |
|
231 |
|
| - |
|
232 |
foreach ($synonymes as $num => $syno) {
|
| - |
|
233 |
$synoTraite = $this->traiterNomSyno($syno);
|
| 230 |
foreach ($synonymes as $num => $syno) {
|
234 |
$nomSci = $this->obtenirNomSci($synoTraite, $infos, $synonymes, $num);
|
| 231 |
$synoTraite = $this->traiterNomSyno($syno);
|
235 |
$rang = $this->obtenirRangNom($nomSci);
|
| 232 |
$complementNom = $this->obtenirComplementNom($synoTraite);
|
236 |
$complementNom = $this->obtenirComplementNom($synoTraite);
|
| 233 |
$auteurCoste = $this->obtenirAuteur($synoTraite);
|
237 |
$auteurCoste = $this->obtenirAuteur($complementNom);
|
| 234 |
$auteur = $this->normaliserAuteur($auteurCoste);
|
238 |
$auteur = $this->normaliserAuteur($auteurCoste);
|
| - |
|
239 |
$this->ajouterAuteur($auteur);
|
| Line 235... |
Line 240... |
| 235 |
$this->ajouterAuteur($auteur);
|
240 |
$biblioCoste = $this->obtenirBiblio($complementNom);
|
| 236 |
$biblioCoste = $this->obtenirBiblio($complementNom);
|
241 |
$annee = $this->extraireAnnee($complementNom);
|
| 237 |
|
242 |
|
| 238 |
$infosSyno = $this->infosCorrespondanceBase;
|
243 |
$infosSyno = $this->infosCorrespondanceBase;
|
| - |
|
244 |
$infosSyno['nom_sci'] = $nomSci;
|
| 239 |
$infosSyno['nom_sci'] = $this->obtenirNomSci($synoTraite, $infos, $synonymes, $num);
|
245 |
$infosSyno['auteur'] = $auteur;
|
| Line 240... |
Line 246... |
| 240 |
$infosSyno['auteur'] = $auteur;
|
246 |
$infosSyno['biblio_origine'] = $biblioCoste;
|
| 241 |
$infosSyno['biblio_origine'] = $biblioCoste;
|
247 |
$infosSyno['annee'] = $annee;
|
| 242 |
$infosSyno['nom_addendum'] = $this->obtenirNomAddendum($syno);
|
248 |
$infosSyno['nom_addendum'] = $this->obtenirNomAddendum($syno);
|
| 243 |
|
249 |
|
| 244 |
$infosSyno['rang'] = $this->obtenirRangSyno($syno);
|
250 |
$infosSyno['rang'] = $rang;
|
| 245 |
$infosSyno['nom_coste'] = $synoTraite;
|
251 |
$infosSyno['nom_coste'] = $synoTraite;
|
| Line 264... |
Line 270... |
| 264 |
return $syno;
|
270 |
return $syno;
|
| 265 |
}
|
271 |
}
|
| Line 266... |
Line 272... |
| 266 |
|
272 |
|
| 267 |
private function obtenirComplementNom($syno) {
|
273 |
private function obtenirComplementNom($syno) {
|
| 268 |
$complementNom = '';
|
274 |
$complementNom = '';
|
| 269 |
if (preg_match('/^(?:[^ ]+ [^ ]+ (?:var|V)[.] [^ ]+|[^ ]+ [^ ]+) (.+)$/', $syno, $match)) {
|
275 |
if (preg_match('/^(?:[^ ]+ [^ ]+ (?:(?:var|V)[.] [^ ]+|STELATUM|MINUS)|[^ ]+ [^ ]+) (.+)$/', $syno, $match)) {
|
| 270 |
$complementNom = $match[1];
|
276 |
$complementNom = $match[1];
|
| 271 |
}
|
277 |
}
|
| 272 |
return $complementNom;
|
278 |
return $complementNom;
|
| Line 278... |
Line 284... |
| 278 |
$biblioCoste = $match[1];
|
284 |
$biblioCoste = $match[1];
|
| 279 |
}
|
285 |
}
|
| 280 |
return $biblioCoste;
|
286 |
return $biblioCoste;
|
| 281 |
}
|
287 |
}
|
| Line -... |
Line 288... |
| - |
|
288 |
|
| - |
|
289 |
private function extraireAnnee($complementNom) {
|
| - |
|
290 |
$annee = '';
|
| - |
|
291 |
if (preg_match('/(?:^| )([0-9]+)$/', $complementNom, $match)) {
|
| - |
|
292 |
$annee = $match[1];
|
| - |
|
293 |
}
|
| - |
|
294 |
return $annee;
|
| - |
|
295 |
}
|
| 282 |
|
296 |
|
| 283 |
private function obtenirAuteur($complementNom) {
|
297 |
private function obtenirAuteur($complementNom) {
|
| - |
|
298 |
$auteurCoste = '';
|
| 284 |
$auteurCoste = '';
|
299 |
if ($complementNom != '') {
|
| 285 |
if (preg_match("/^((?!(?:auct.+|(?:, )?(?:non|an) .+|p[.] p[.])$).+)$/", $complementNom, $match)) {
|
300 |
if (preg_match("/^((?!(?:auct.+|(?:, )?(?:non|an) .+|p[.] p[.])$).+)$/", $complementNom, $match)) {
|
| 286 |
$auteurCoste = $this->traiterAuteur($match[1]);
|
301 |
$auteurCoste = $this->traiterAuteur($match[1]);
|
| 287 |
} else {
|
302 |
} else {
|
| 288 |
$message = "Impossible de récupérer l'auteur pour le complément de nom ($complementNom).";
|
303 |
$message = "Impossible de récupérer l'auteur pour le complément de nom ($complementNom).";
|
| - |
|
304 |
$this->ajouterLogProbleme($message);
|
| 289 |
$this->ajouterLogProbleme($message);
|
305 |
}
|
| 290 |
}
|
306 |
}
|
| 291 |
return $auteurCoste;
|
307 |
return $auteurCoste;
|
| Line 292... |
Line 308... |
| 292 |
}
|
308 |
}
|
| Line 296... |
Line 312... |
| 296 |
if ($auteurCoste != '') {
|
312 |
if ($auteurCoste != '') {
|
| 297 |
$remplacementTxt = array(' p. p.', ' saltem part.', 'Fl. fr.');
|
313 |
$remplacementTxt = array(' p. p.', ' saltem part.', 'Fl. fr.');
|
| 298 |
$auteurCoste = str_replace($remplacementTxt, '', $auteurCoste);
|
314 |
$auteurCoste = str_replace($remplacementTxt, '', $auteurCoste);
|
| 299 |
$remplacementsRegExp = array(
|
315 |
$remplacementsRegExp = array(
|
| 300 |
' [0-9]{4}',
|
316 |
' [0-9]{4}',
|
| - |
|
317 |
'[^ ]+ et auct[.], .+',
|
| 301 |
' auct.+',
|
318 |
' auct.+',
|
| 302 |
',? part[.]',
|
319 |
',? part[.]',
|
| 303 |
' p[.] [0-9]{1,}',
|
320 |
' p[.] [0-9]{1,}',
|
| 304 |
' in .+|,? (?:non|an) .+',
|
321 |
' in .+|,? (?:non|an) .+',
|
| 305 |
'(?: Sp[.])? ed[.] [1-2]');
|
322 |
'(?: Sp[.])? ed[.] [1-2]');
|
| Line 320... |
Line 337... |
| 320 |
$syno = $this->nettoyerEspacesNomSyno($syno);
|
337 |
$syno = $this->nettoyerEspacesNomSyno($syno);
|
| 321 |
$nomAddendum = array();
|
338 |
$nomAddendum = array();
|
| 322 |
if (preg_match('/^((?:compr|incl)[.]) /', $syno, $match)) {
|
339 |
if (preg_match('/^((?:compr|incl)[.]) /', $syno, $match)) {
|
| 323 |
$nomAddendum[] = '['.$match[1].']';
|
340 |
$nomAddendum[] = '['.$match[1].']';
|
| 324 |
}
|
341 |
}
|
| - |
|
342 |
if (preg_match('/ ([^ ]+ et auct[.], .+)$/', $syno, $match)) {
|
| - |
|
343 |
$nomAddendum[] = '['.$match[1].']';
|
| 325 |
if (preg_match('/ (auct[.] .+)$/', $syno, $match)) {
|
344 |
} elseif (preg_match('/ (auct[.],? .+)$/', $syno, $match)) {
|
| 326 |
$nomAddendum[] = '['.$match[1].']';
|
345 |
$nomAddendum[] = '['.$match[1].']';
|
| 327 |
} else if (preg_match('/,? ((?:non|an) .+)$/', $syno, $match)) {
|
346 |
} else if (preg_match('/,? ((?:non|an) .+)$/', $syno, $match)) {
|
| 328 |
$nomAddendum[] = '['.$match[1].']';
|
347 |
$nomAddendum[] = '['.$match[1].']';
|
| 329 |
} else if (preg_match('/ (p[.] p[.])$/', $syno, $match)) {
|
348 |
} else if (preg_match('/ (p[.] p[.])$/', $syno, $match)) {
|
| 330 |
$nomAddendum[] = '['.$match[1].']';
|
349 |
$nomAddendum[] = '['.$match[1].']';
|
| Line 390... |
Line 409... |
| 390 |
|
409 |
|
| 391 |
|
410 |
|
| Line 392... |
Line 411... |
| 392 |
private function obtenirNomSci($syno, $infos, $synonymes, $num) {
|
411 |
private function obtenirNomSci($syno, $infos, $synonymes, $num) {
|
| 393 |
$nomSci = $this->remplacerAbreviationGenre($syno, $infos, $synonymes, $num);
|
412 |
$nomSci = $this->remplacerAbreviationGenre($syno, $infos, $synonymes, $num);
|
| 394 |
|
413 |
|
| 395 |
if (preg_match('/^([^ ]+) ([^ ]+) (?:(?:var|V)[.] ([^ ]+)|(STELATUM) )/', $nomSci, $match)) {
|
414 |
if (preg_match('/^([^ ]+) ([^ ]+) (?:(?:var|V)[.] ([^ ]+)|(STELATUM||MINUS) )/', $nomSci, $match)) {
|
| 396 |
$genre = $this->normaliserGenre($match[1]);
|
415 |
$genre = $this->normaliserGenre($match[1]);
|
| 397 |
$sp = $this->normaliserEpithete($match[2]);
|
416 |
$sp = $this->normaliserEpithete($match[2]);
|
| Line 419... |
Line 438... |
| 419 |
$sp = mb_strtolower($sp);
|
438 |
$sp = mb_strtolower($sp);
|
| 420 |
$sp = str_replace('Æ', 'æ', $sp);
|
439 |
$sp = str_replace('Æ', 'æ', $sp);
|
| 421 |
return $sp;
|
440 |
return $sp;
|
| 422 |
}
|
441 |
}
|
| Line 423... |
Line 442... |
| 423 |
|
442 |
|
| 424 |
private function obtenirRangSyno($syno) {
|
443 |
private function obtenirRangNom($syno) {
|
| 425 |
$rang = 290;
|
444 |
$rang = 290;
|
| 426 |
if (strpos($syno, ' var. ')) {
|
445 |
if (strpos($syno, ' var. ')) {
|
| 427 |
$rang = 340;
|
446 |
$rang = 340;
|
| 428 |
}
|
447 |
}
|