Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 458 → Rev 459

/trunk/scripts/modules/coste/Description.php
113,7 → 113,7
$this->messages->traiterErreur("Le dossier {$this->nomDossier} est introuvable.");
}
 
arsort($this->listeFichiers);
asort($this->listeFichiers);
}
 
private function verifierFichier() {
161,6 → 161,7
$titre = $donnees['titre'];
if (preg_match('/^Coste ([0-9]+) - ((?:(?! - ).)+) - F[0-9]+, (?:(?! - ).)+ - (G[0-9]+), T([123])[.]p([0-9]+)$/', $titre, $match)) {
$infos['num_nom_coste'] = $match[1];
$infos['num_nom_retenu_coste'] = $match[1];
$infos['nom_sci'] = $match[2];
$infos['num_tax_sup_coste'] = $match[3];
$infos['tome'] = $match[4];
180,7 → 181,8
$txt = $donnees['texte'];
$txt = $this->corrigerDescription($txt);
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)) {
$infos['nom_coste'] = trim($match[1]);
$infos['nom_coste'] = trim($match[1]);
$infos['rang'] = $this->obtenirRangNom($infos['nom_coste']);
$infos['auteur_coste'] = trim($match[2]);
$infos['nom_francais'] = isset($match[3]) ? $match[3] : '';
$infos['nom_francais'] = isset($match[4]) && isset($match[5]) ? $match[4].$match[5] : $infos['nom_francais'];
229,19 → 231,23
 
foreach ($synonymes as $num => $syno) {
$synoTraite = $this->traiterNomSyno($syno);
$nomSci = $this->obtenirNomSci($synoTraite, $infos, $synonymes, $num);
$rang = $this->obtenirRangNom($nomSci);
$complementNom = $this->obtenirComplementNom($synoTraite);
$auteurCoste = $this->obtenirAuteur($synoTraite);
$auteurCoste = $this->obtenirAuteur($complementNom);
$auteur = $this->normaliserAuteur($auteurCoste);
$this->ajouterAuteur($auteur);
$biblioCoste = $this->obtenirBiblio($complementNom);
$annee = $this->extraireAnnee($complementNom);
 
$infosSyno = $this->infosCorrespondanceBase;
$infosSyno['nom_sci'] = $this->obtenirNomSci($synoTraite, $infos, $synonymes, $num);
$infosSyno['nom_sci'] = $nomSci;
$infosSyno['auteur'] = $auteur;
$infosSyno['biblio_origine'] = $biblioCoste;
$infosSyno['biblio_origine'] = $biblioCoste;
$infosSyno['annee'] = $annee;
$infosSyno['nom_addendum'] = $this->obtenirNomAddendum($syno);
 
$infosSyno['rang'] = $this->obtenirRangSyno($syno);
$infosSyno['rang'] = $rang;
$infosSyno['nom_coste'] = $synoTraite;
$infosSyno['auteur_coste'] = $auteurCoste;
$infosSyno['biblio_coste'] = $biblioCoste;
266,7 → 272,7
 
private function obtenirComplementNom($syno) {
$complementNom = '';
if (preg_match('/^(?:[^ ]+ [^ ]+ (?:var|V)[.] [^ ]+|[^ ]+ [^ ]+) (.+)$/', $syno, $match)) {
if (preg_match('/^(?:[^ ]+ [^ ]+ (?:(?:var|V)[.] [^ ]+|STELATUM|MINUS)|[^ ]+ [^ ]+) (.+)$/', $syno, $match)) {
$complementNom = $match[1];
}
return $complementNom;
280,13 → 286,23
return $biblioCoste;
}
 
private function extraireAnnee($complementNom) {
$annee = '';
if (preg_match('/(?:^| )([0-9]+)$/', $complementNom, $match)) {
$annee = $match[1];
}
return $annee;
}
 
private function obtenirAuteur($complementNom) {
$auteurCoste = '';
if (preg_match("/^((?!(?:auct.+|(?:, )?(?:non|an) .+|p[.] p[.])$).+)$/", $complementNom, $match)) {
$auteurCoste = $this->traiterAuteur($match[1]);
} else {
$message = "Impossible de récupérer l'auteur pour le complément de nom ($complementNom).";
$this->ajouterLogProbleme($message);
if ($complementNom != '') {
if (preg_match("/^((?!(?:auct.+|(?:, )?(?:non|an) .+|p[.] p[.])$).+)$/", $complementNom, $match)) {
$auteurCoste = $this->traiterAuteur($match[1]);
} else {
$message = "Impossible de récupérer l'auteur pour le complément de nom ($complementNom).";
$this->ajouterLogProbleme($message);
}
}
return $auteurCoste;
}
298,6 → 314,7
$auteurCoste = str_replace($remplacementTxt, '', $auteurCoste);
$remplacementsRegExp = array(
' [0-9]{4}',
'[^ ]+ et auct[.], .+',
' auct.+',
',? part[.]',
' p[.] [0-9]{1,}',
322,8 → 339,10
if (preg_match('/^((?:compr|incl)[.]) /', $syno, $match)) {
$nomAddendum[] = '['.$match[1].']';
}
if (preg_match('/ (auct[.] .+)$/', $syno, $match)) {
if (preg_match('/ ([^ ]+ et auct[.], .+)$/', $syno, $match)) {
$nomAddendum[] = '['.$match[1].']';
} elseif (preg_match('/ (auct[.],? .+)$/', $syno, $match)) {
$nomAddendum[] = '['.$match[1].']';
} else if (preg_match('/,? ((?:non|an) .+)$/', $syno, $match)) {
$nomAddendum[] = '['.$match[1].']';
} else if (preg_match('/ (p[.] p[.])$/', $syno, $match)) {
392,7 → 411,7
private function obtenirNomSci($syno, $infos, $synonymes, $num) {
$nomSci = $this->remplacerAbreviationGenre($syno, $infos, $synonymes, $num);
 
if (preg_match('/^([^ ]+) ([^ ]+) (?:(?:var|V)[.] ([^ ]+)|(STELATUM) )/', $nomSci, $match)) {
if (preg_match('/^([^ ]+) ([^ ]+) (?:(?:var|V)[.] ([^ ]+)|(STELATUM||MINUS) )/', $nomSci, $match)) {
$genre = $this->normaliserGenre($match[1]);
$sp = $this->normaliserEpithete($match[2]);
$infrasp = isset($match[4]) ? $match[4] : $match[3];
421,7 → 440,7
return $sp;
}
 
private function obtenirRangSyno($syno) {
private function obtenirRangNom($syno) {
$rang = 290;
if (strpos($syno, ' var. ')) {
$rang = 340;