Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 343 → Rev 344

/trunk/scripts/bibliotheque/nom_sci/DecoupageCitation.php
New file
0,0 → 1,106
<?php
// Encodage : UTF-8
// +-------------------------------------------------------------------------------------------------------------------+
/**
* Découpage des citations bibliographiques.
*
* Description : classe permettant de découper les citations.
*
//Auteur original :
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Tela-Botanica 1999-2009
* @licence GPL v3 & CeCILL v2
* @version $Id: DecoupageCitation.class.php 1873 2009-03-31 10:07:24Z Jean-Pascal MILCENT $
*/
// +-------------------------------------------------------------------------------------------------------------------+
class DecoupageCitation extends Decoupage {
 
private $expression_principale = array();
private $expression_page = array();
 
function DecoupageCitation()
{
parent::__construct();
 
// Biblio
$this->expression_principale[1] = '/^(?:, |)(?:('.$this->Com.')|)(?:('.$this->In.'), |)(?:'.$this->Bib.'|)(?: ('.$this->Inf.')|)$/u';
// Biblio à exclure
$this->expression_principale[2] = '/^,? ('.$this->HomCourt.')$/u';
// Biblio : abréviation publi et précision (volume, tome, édition...)
$this->expression_ref[1] = '/^([^,$]+)(.*)$/u';//
// Pages début et fin
$this->expression_page[1] = '/^(\d+)-(\d+)$/u';//
// Page unique
$this->expression_page[2] = '/^(\d+)(?:\.|)$/u';//
}
public function decouper($citation)
{
$aso_nom_decompo = array( 'num_nomenc' => '', 'num_taxo' => '',
'in_auteur' => '', 'abreviation' => '', 'precision' => '',
'annee' => '', 'source_biblio_exclure' => '',
'info_combinaison' => '', 'page_debut' => null,'page_fin' => null,
'page_erreur_mark' => '', 'page_erreur_notes' => '');
$aso_nom_decompo['citation_complete'] = $citation;
while ($citation != '') {
$morceau = array();
if (preg_match($this->expression_principale[1], $citation, $morceau)) {// Biblio
$aso_nom_decompo['info_combinaison'] = $morceau[1];
$aso_nom_decompo['in_auteur'] = $morceau[2];
$aso_publi = $this->decouperPubli($morceau[3]);
$aso_nom_decompo['abreviation'] = $aso_publi['abreviation'];
$aso_nom_decompo['precision'] = $aso_publi['precision'];
$aso_nom_decompo['pages'] = $morceau[4];
$aso_pages = $this->decouperPages($morceau[4]);
$aso_nom_decompo['page_debut'] = $aso_pages['page_debut'];
$aso_nom_decompo['page_fin'] = $aso_pages['page_fin'];
$aso_nom_decompo['page_erreur_mark'] = $aso_pages['erreur_mark'];
$aso_nom_decompo['page_erreur_notes'] = $aso_pages['erreur_notes'];
$aso_nom_decompo['annee'] = $morceau[5];
$citation = $morceau[6];
} else if (preg_match($this->expression_principale[2], $citation, $morceau)) {// Nom d'sp.
$aso_nom_decompo['source_biblio_exclure'] = $morceau[1];
$citation = $morceau[2];
} else {// Erreurs
$aso_nom_decompo['erreur_mark'] = 'erreur';
$aso_nom_decompo['erreur_notes'] = $citation;
$citation = '';
}
}
return $aso_nom_decompo;
}
public function decouperPubli($ref)
{
$ref = trim($ref);
$aso_ref = array('abreviaton' => null,'precision' => null, 'erreur_mark' => '', 'erreur_notes' => '');
if (preg_match($this->expression_ref[1], $ref, $morceau)) {
$aso_ref['abreviation'] = $morceau[1];
$aso_ref['precision'] = preg_replace('/^\s*,\s*/', '', $morceau[2]);
} else {// Erreurs
$aso_ref['erreur_mark'] = 'erreur';
$aso_ref['erreur_notes'] = $ref;
}
return $aso_ref;
}
public function decouperPages($pages)
{
$pages = trim($pages);
$aso_pages = array('page_debut' => null,'page_fin' => null, 'erreur_mark' => '', 'erreur_notes' => '');
if (preg_match($this->expression_page[1], $pages, $morceau)) {
$aso_pages['page_debut'] = $morceau[1];
$aso_pages['page_fin'] = $morceau[2];
} else if (preg_match($this->expression_page[2], $pages, $morceau)) {
$aso_pages['page_debut'] = $morceau[1];
} else {// Erreurs
$aso_pages['erreur_mark'] = 'erreur';
$aso_pages['erreur_notes'] = $pages;
}
return $aso_pages;
}
}
?>
/trunk/scripts/bibliotheque/nom_sci/Decoupage.php
New file
0,0 → 1,160
<?php
// Encodage : UTF-8
// +-------------------------------------------------------------------------------------------------------------------+
/**
* Découpage
*
* Description : classe abstraite mettant en comun des expressions régulière pour le découpage des noms latins.
*
//Auteur original :
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Tela-Botanica 1999-2009
* @licence GPL v3 & CeCILL v2
* @version $Id: Decoupage.class.php 1873 2009-03-31 10:07:24Z Jean-Pascal MILCENT $
*/
// +-------------------------------------------------------------------------------------------------------------------+
abstract class Decoupage {
protected $min = '[a-z\x{E0}-\x{FF}\x{153}]';// Lettres minuscules : a à z et &#224; à &#255 et &#339;
protected $maj = "[A-Z'\x{C0}-\x{DF}\x{152}]";// Lettres majuscules : A à Z, ' et &#192; à &#223; et &#338;
protected $hyb = '[+xX]';
protected $SupraSp;// Nom de type suprasp.
protected $GenHy;// Hybride intergénérique
protected $Gen;// Genre
protected $Dou = '(?:\(\?\)|\?)';// Doute
protected $Epi_cv;// Epithete de cultivar
protected $Epi_nn_hy = '(?:nsp\.|)';// Epithète non nommé hybride
protected $Epi_nn = '(?:sp\.[1-9]?|spp\.|)';// Epithète non nommé
protected $Epi;// Epithete
//------------------------------------------------------------------------------------------------------------//
protected $Ran_ig = '[Ss]ect\.|subg(?:en|)\.|ser\.|subser\.';// Rang taxonomique infragénérique de type : sous-genre
protected $Ran_ig_gr = 'gr\.';// Rang taxonomique infragénérique de type : groupe
protected $Ran_ig_agg = 'agg\.';// Rang taxonomique infragénérique de type : aggrégat
protected $Ran_bo_i1 = 'subsp\.';// Rang taxonomique infraspécifique de niveau 1
protected $Ran_bo_i2 = 'var\.|subvar\.';// Rang taxonomique infraspécifique de niveau 2
protected $Ran_bo_i3 = 'f\.|fa\.|fa|forma';// Rang taxonomique infraspécifique de niveau 3
protected $Ran_bo_i4 = 'race|prole|proles|prol\.';// Rang taxonomique infraspécifique de niveau 4
protected $Ran_bo;// Rang taxonomique infraspécifique botanique non hybride
protected $Ran_hy_i1 = 'n-subsp\.|\[subsp\.\]|\[n-subsp\.\]';// Rang taxonomique infraspécifique hybride de niveau 1
protected $Ran_hy_i2 = '\[var\.\]|n-var\.|\[n-var\.\]';// Rang taxonomique infraspécifique hybride de niveau 2
protected $Ran_hy_i3 = '';// Rang taxonomique infraspécifique hybride de niveau 3
protected $Ran_hy_i4 = 'n-proles\.';// Rang taxonomique infraspécifique hybride de niveau 4
protected $Ran_hy;// Rang taxonomique infraspécifique hybridre
protected $Ran_ht = 'convar\.|[cC]v\.';// Rang taxonomique horticole
protected $Ran;// Rang taxonomique infraspécifique non hybride, hybride et horticole
//------------------------------------------------------------------------------------------------------------//
protected $Ini;// Initiale de prénoms
protected $Pre;// Prénoms
protected $Par = '(?i:de|des|le|la|de la|von|van|st\.|el)';// Particules
protected $ParSsEs = "(?i:st\.-|d)";// Particules sans espace après
protected $Nom; // Abreviation d'un nom d'auteur. Le "f." c'est pour "filius" et c'est collé au nom
protected $NomSpe = '(?:[A-Z]\. (?:DC\.|St\.-Hil\.))|\(?hort\.\)?|al\.';// Prénom + nom spéciaux : "hort." est utilisé comme un nom d'auteur mais cela signifie "des jardins". "DC." est une exception deux majuscule suivi d'un point.
protected $Int;// Intitulé d'auteurs (Prénom + Nom)
//------------------------------------------------------------------------------------------------------------//
protected $AutNo;// Intitulé auteur sans "ex", ni "&", ni "et", ni parenthèses
protected $AutNoTa;// Intitulé auteur sans "ex", ni "&", ni "et" mais avec parenthèses possible pour la nomenclature
protected $AutEx;// Intitulé auteur avec "ex"
protected $et = '(?:&|et)';
protected $AutExEt;// Intitulé auteur avec "ex" et "&" ou "et"
protected $AutEt;// Intitulé auteur avec "&" ou "et" et sans parenthèse spécifique à la nomenclature
protected $AutEtTa;// Intitulé auteur avec "&" ou "et" et avec ou sans parenthèse spécifique à la nomenclature
protected $AutBib;// Intitulés auteurs pour la biblio
protected $AutInc = 'AUTEUR\?';// Intitulé auteur spéciaux pouvant être trouvés entre parenthèses
protected $AutSpe;// Intitulé auteur spéciaux pouvant être trouvés entre parenthèses
protected $AutSpeSe;// Intitulé auteur spéciaux type "sensu"
protected $AutSpeTa;// Intitulé auteur spéciaux propre à la nomenclature
protected $Aut;// Tous les intitulés auteurs possibles
protected $Auteur;// Tous les intitulés auteurs possibles
//------------------------------------------------------------------------------------------------------------//
protected $ComEmend;// Commentaires nomenclaturaux
protected $ComPp = 'p\.p\.';// Commentaires nomenclaturaux
protected $Com;// Intitulé auteur spéciaux type "sensu"
protected $ComNom = '\(?(?:hort\. non .*|sensu .*|auct\..*|comb\.\s*(?:nov\.|ined\.)|comb?\.\s*nov\.\s*provis\.|stat\.\s*provis\.|nov\.\s*stat\.|stat\.\s*nov\.|p\.p\.|emend\.)\)?';
//------------------------------------------------------------------------------------------------------------//
protected $In;// In auteur
protected $AneMoCo = 'janvier|fevrier|mars|avril|mai|juin|juillet|ao\x{FB}t|septembre|octobre|novembre|decembre'; //Mois devant l'année
protected $AneMoAb = 'janv\.|f[e\x{E9}]v\.|sept\.|oct\.|d\x{E9}c\.'; //Mois devant l'année
protected $AneBaSi = '(?:\d{4}|\d{4} ?\?|DATE \?)';// Date
protected $AneBaCo = '(?:\d{4}-\d{4}|\d{4}-\d{2})';// Date
protected $AneDo = '\?';// Doute
protected $AneBa;// Date
protected $AneSpe;// Date
protected $Ane;// Date
//------------------------------------------------------------------------------------------------------------//
// Spécial BDNFF :
protected $Date = ' \[.*\]';
protected $Num = '[0-9]|3\*|4\*';# Gestion des numéros de flore
protected $NumAuteur;# Gestion des numéros de flore mélangés ou pas au nom d'auteur
//------------------------------------------------------------------------------------------------------------//
protected $BibBa;// Biblio de base : \x{B0} = ° \x{AB}\x{BB} = «» \x{26} = &
protected $Bib;// Biblio de taxon
protected $BibAu = '.+';// Biblio supplémentaire
//------------------------------------------------------------------------------------------------------------//
protected $ErrDet;// Biblio à exclure base
//------------------------------------------------------------------------------------------------------------//
protected $HomNon = 'non';// Homonymes à exclure : négation
protected $HomBa;// Homonymes à exclure base
protected $Hom;// Homonymes à exclure avec non et nec
protected $HomCourt;// Homonymes à exclure avec non et nec avec expression régulière plus courte!
//------------------------------------------------------------------------------------------------------------//
protected $Inf = '.*';// Informations supplémentaires
public function __construct()
{
//mb_internal_encoding('UTF-8');
//mb_regex_encoding('UTF-8');
//setlocale(LC_ALL, 'fr-fr');
$this->SupraSp = '(?:'.$this->maj.$this->min.'+|'.$this->maj.$this->min.'+-'.$this->maj.$this->min.'+)';// Nom de type suprasp.
$this->GenHy = "[Xx] $this->SupraSp";// Hybride intergénérique
$this->Gen = "$this->SupraSp|$this->GenHy";
$this->Epi_cv = "$this->maj.(?:$this->min|-)+";// Epithete de cultivar
$this->Epi_nn = $this->Epi_nn.$this->Epi_nn_hy;
$this->Epi = "(?:(?:$this->min|-|')+|$this->Epi_nn)";// Epithete
$this->Ran_ig = $this->Ran_ig.'|'.$this->Ran_ig_gr;
$this->Ran_bo = "$this->Ran_bo_i1|$this->Ran_bo_i2|$this->Ran_bo_i3|$this->Ran_bo_i4";// Rang taxonomique infraspécifique botanique non hybride
$this->Ran_hy = "$this->Ran_hy_i1|$this->Ran_hy_i2|$this->Ran_hy_i3|$this->Ran_hy_i4";// Rang taxonomique infraspécifique hybridre
$this->Ran = "(?:$this->Ran_ig|$this->Ran_bo|$this->Ran_hy|$this->Ran_ht)";// Rang taxonomique infraspécifique non hybride, hybride et horticole
$this->Ini = '(?:'.$this->maj.'[.]|'.$this->maj.$this->min.'+[.]?)';// Initiale de prénoms
$this->Pre = $this->Ini.'{1,3}|'.$this->Ini.'[\- ]'.$this->Ini;// Prénoms
$this->Nom = '(?:'.$this->maj."'".$this->maj.'|'.$this->maj.'|'.$this->maj.$this->min."+'".$this->min.'+)'.$this->min.'*[.]?(?: ?f\.|)';
$this->Int = "(?:(?:$this->Pre ?|)(?:$this->Par |$this->ParSsEs|)(?:$this->Nom|$this->Nom".'[\- .]'."$this->Nom)|$this->NomSpe)";// Intitulé d'auteurs (Prénom + Nom)
$this->AutNo = "$this->Int";// Intitulé auteur sans "ex", ni "&", ni "et", ni parenthèses
$this->AutNoTa = "$this->AutNo|$this->NomSpe $this->Int|\($this->Int\) $this->Int";// Intitulé auteur sans "ex", ni "&", ni "et" mais avec parenthèses possible pour la nomenclature
$this->AutEx = "\($this->Int\) $this->Int ex $this->Int|\($this->Int ex $this->Int\) $this->Int|$this->Int ex $this->Int";// Intitulé auteur avec "ex"
$this->AutExEt = "$this->Int $this->et $this->Int ex $this->Int|$this->Int $this->et $this->Int ex $this->Int $this->et $this->Int|$this->Int ex $this->Int $this->et $this->Int|\($this->Int ex $this->Int $this->et $this->Int\) $this->Int|\($this->Int ex $this->Int\) $this->Int $this->et $this->Int|\($this->Int $this->et $this->Int\) $this->Int ex $this->Int|$this->NomSpe $this->Int ex $this->Int";// Intitulé auteur avec "ex" et "&" ou "et"
$this->AutEt = "$this->Int $this->et $this->Int";// Intitulé auteur avec "&" ou "et" et sans parenthèse spécifique à la nomenclature
$this->AutEtTa = "\($this->Int\) $this->Int $this->et $this->Int|\($this->Int $this->et $this->Int\) $this->Int|$this->AutEt";// Intitulé auteur avec "&" ou "et" et avec ou sans parenthèse spécifique à la nomenclature
$this->AutBib = "(?:$this->AutNo|$this->AutEt)";// Intitulés auteurs pour la biblio
$this->AutSpe = "(?:sensu |)auct\.|auct\. mult\.|$this->AutInc";// Intitulé auteur spéciaux pouvant être trouvés entre parenthèses
$this->AutSpeSe = "sensu $this->AutBib";// Intitulé auteur spéciaux type "sensu"
$this->AutSpeTa = "$this->AutSpe|\((?:$this->AutSpe)\)|$this->AutSpeSe";// Intitulé auteur spéciaux propre à la nomenclature
$this->Aut = "(?:$this->AutExEt|$this->AutEx|$this->AutEtTa|$this->AutSpeTa|$this->AutNoTa)";// Tous les intitulés auteurs possibles
$this->Auteur = $this->Int.'|'.$this->Int.' '.$this->et.' '.$this->Int.'|(?:'.$this->Int.', )+'.$this->Int.' '.$this->et.' '.$this->Int;// Intitulé auteur avec "&" ou "et";
$this->ComEmend = "emend\. $this->AutBib";// Commentaires nomenclaturaux
$this->Com = "$this->ComEmend|$this->ComPp";// Intitulé auteur spéciaux type "sensu"
$this->In = "[iI]n $this->AutBib";// In auteur
$this->AneBa = "$this->AneBaSi|$this->AneBaCo";// Date
$this->AneSpe = "(?:$this->AneBa ?\[$this->AneBa\]|(?:$this->AneMoCo|$this->AneMoAb) $this->AneBaSi|$this->AneBaSi $this->AneBaSi)";// Date
$this->Ane = "$this->AneBa||$this->AneDo|$this->AneSpe";// Date
$this->BibBa = "(?:$this->maj$this->min*[.]?|in|hort\.)(?:$this->min*[.]?|[\d\/\- ,()'\x{B0}\x{26}\x{AB}\x{BB}[\]?])*";// Biblio de base : \x{B0} = ° \x{AB}\x{BB} = «» \x{26} = &
$this->Bib = "([^:]+):(.+?)\(($this->Ane)\)";// Biblio de taxon
$this->ErrDet = "($this->AutSpe,? non $this->Aut): ($this->Bib;?)+";// Biblio à exclure base
$this->HomBa = "$this->Aut \($this->Ane\)";// Homonymes à exclure base
$this->Hom = "$this->HomNon $this->HomBa(?: nec $this->HomBa)*?";// Homonymes à exclure avec non et nec
$this->HomCourt = "$this->HomNon .+?(?: nec .+?)*?";// Homonymes à exclure avec non et nec avec expression régulière plus courte!
$this->NumAuteur = $this->Num.'|(?:(?:'.$this->Num.'|'.$this->Auteur.'), )+(?:'.$this->Num.'|'.$this->Auteur.')';# Gestion des numéros de flore mélangés ou pas au nom d'auteur
}
}
?>
/trunk/scripts/bibliotheque/nom_sci/DecoupageNomLatin.php
New file
0,0 → 1,378
<?php
// Encodage : UTF-8
// +-------------------------------------------------------------------------------------------------------------------+
/**
* Découpage des noms latins
*
* Description : classe permettant de découper les noms latins.
*
//Auteur original :
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Tela-Botanica 1999-2009
* @licence GPL v3 & CeCILL v2
* @version $Id: DecoupageNomLatin.class.php 1873 2009-03-31 10:07:24Z Jean-Pascal MILCENT $
*/
// +-------------------------------------------------------------------------------------------------------------------+
class DecoupageNomLatin extends Decoupage {
 
private $expression_principale = array();
private $expression_complement = array();
 
function DecoupageNomLatin()
{
parent::__construct();
 
// Genre et nom supragénérique
$this->expression_principale[1] = "/^((?:$this->hyb |)$this->Gen)(?:( $this->Inf)|)$/u";
// Sp
$this->expression_principale[2] = "/^((?:$this->hyb |)$this->Gen) ((?:($this->hyb) |$this->Dou|)(?:$this->Epi|$this->Dou))(?:((?:,| $this->Ran) $this->Inf)| agg\.|)$/u";
// Rang infragénérique et supraspécifique
$this->expression_principale[3] = '/^('.$this->Gen.') ('.$this->Ran.') ('.$this->Gen.'|.'.$this->Epi.')(?:(, '.$this->Inf.')|)$/u';
// Hybride interspécifique
$this->expression_principale[4] = "/^((?:$this->Gen) $this->Epi (?:($this->Ran) $this->Epi )?x $this->Epi(?: ($this->Ran) $this->Epi)?)$/u";
// Aggrégat
$this->expression_principale[5] = "/^($this->Gen) ($this->Epi) (agg\.)(?:( $this->Inf)|)$/u";//
// Epithète infra-spécifique
$this->expression_complement[1] = "/^ ($this->Ran) ((?:($this->hyb) |$this->Dou|)(?:$this->Epi|$this->Dou))(?:((?:,| $this->Ran) $this->Inf)|)$/Uu";
// Cultivar
$this->expression_complement[5] = "/^ ($this->Ran_ht) ((?:(?:$this->Epi_cv) ?)+)$/u";
}
public function decouper($nom_latin)
{
$aso_nom_decompo = array( 'nom_genre' => '', 'nom_sp' => '', 'auteur_sp' => '', 'nom_complement' => '',
'type_infrasp' => '', 'nom_infrasp' => '',
'num_nomenc' => '', 'num_taxo' => '', 'rang_taxonomique' => '',
'nom_courant' => '', 'nom_superieur' => '', 'agg' => '');
$aso_nom_decompo['nom_complet'] = $nom_latin;
while ($nom_latin != '') {
$morceau = array();
if (preg_match($this->expression_principale[4], $nom_latin, $morceau)) {// Formule d'hybridation
// Nous tentons de déterminer le rang de l'hybride
if (isset($morceau[2]) && isset($morceau[3]) && $morceau[2] == $morceau[3]) {
$aso_nom_decompo['rang_taxonomique'] = $this->attribuerCodeRang('n-'.$morceau[2]);
} else {
$aso_nom_decompo['rang_taxonomique'] = 260;// Hybride instersp.
}
$aso_nom_decompo['mark_hybride_interspecifique'] = 'x';
$aso_nom_decompo['formule_hybridation'] = $morceau[0];
$nom_latin = '';
} else if (preg_match($this->expression_principale[5], $nom_latin, $morceau)) {// agg.
$aso_nom_decompo['rang_taxonomique'] = 240;// agg.
$aso_nom_decompo['nom_genre'] = $morceau[1];
$aso_nom_decompo['nom_sp'] = $morceau[2];
$aso_nom_decompo['agg'] = $morceau[3];
$nom_latin = $morceau[4];
$aso_nom_decompo['nom_superieur'] = $morceau[1];
$aso_nom_decompo['nom_courant'] = $morceau[2];
} else if (preg_match($this->expression_principale[2], $nom_latin, $morceau)) {// Nom d'sp.
// Nous regardons si nous avons à faire à un hybride
if (preg_match('/^'.$this->hyb.'$/', $morceau[3])) {
$aso_nom_decompo['rang_taxonomique'] = 260;// hybride intersp.
$aso_nom_decompo['mark_hybride_interspecifique'] = strtolower($morceau[3]);
} else if (preg_match('/^'.$this->Epi_nn_hy.'$/', $morceau[2])) {
$aso_nom_decompo['rang_taxonomique'] = 260;// hybride intersp.
$aso_nom_decompo['mark_hybride_interspecifique'] = 'x';
} else {
$aso_nom_decompo['rang_taxonomique'] = 250;// sp.
}
// Nous atribuons le genre
$aso_nom_decompo['nom_genre'] = $morceau[1];
// Nous regardons si nous avons à faire à une phrase non nommé (ex : sp.1, spp., nsp.)
if (preg_match('/^'.$this->Epi_nn.'$/', $morceau[2])) {
$aso_nom_decompo['phrase_nom_non_nomme'] = $morceau[2];// hybride intersp.
$aso_nom_decompo['nom_sp'] = '';
} else {
$aso_nom_decompo['nom_sp'] = $morceau[2];
}
$nom_latin = $morceau[4];
$aso_nom_decompo['nom_superieur'] = $morceau[1];
$aso_nom_decompo['nom_courant'] = $morceau[2];
} else if (preg_match($this->expression_principale[3], $nom_latin, $morceau)) {// Nom infragénérique et supraspécifique
$aso_nom_decompo['nom_genre'] = $morceau[1];
$aso_nom_decompo['rang_taxonomique'] = $this->attribuerCodeRang($morceau[2]);
// Nous regardons si nous avons à faire à un groupe
if (preg_match('/^'.$this->Ran_ig_gr.'$/', $morceau[2])) {
$aso_nom_decompo['nom_sp'] = $morceau[3];
} else {
$aso_nom_decompo['nom_infra_genre'] = $morceau[3];
}
$nom_latin = $morceau[4];
$aso_nom_decompo['nom_superieur'] = $morceau[1];
$aso_nom_decompo['nom_courant'] = $morceau[3];
} else if (preg_match($this->expression_principale[1], $nom_latin, $morceau)) {// Nom de genre et supragénérique
$aso_nom_decompo['rang_taxonomique'] = $this->verifierTerminaisonLatine($nom_latin);
$aso_nom_decompo['nom_suprasp'] = $morceau[1];
$nom_latin = $morceau[2];
$aso_nom_decompo['nom_superieur'] = null;
$aso_nom_decompo['nom_courant'] = $morceau[1];
} else if (preg_match($this->expression_complement[5], $nom_latin, $morceau)) {// Cultivar
$aso_nom_decompo['rang_cultivar'] = $this->attribuerCodeRang($morceau[1]);
// Nous vérifions si nous avons à faire à un cultivar d'hybride
if ($aso_nom_decompo['mark_hybride_interspecifique'] == 'x' && $aso_nom_decompo['rang_cultivar'] == 460) {
$aso_nom_decompo['rang_cultivar'] = 470;
}
$aso_nom_decompo['cultivar'] = $morceau[2];
$nom_latin = '';
} else if (preg_match($this->expression_complement[1], $nom_latin, $morceau)) {// Nom infrasp.
if (preg_match('/^'.$this->hyb.'$/', $morceau[3])) {
$aso_nom_decompo['mark_hybride_interspecifique'] = strtolower($morceau[3]);
}
$aso_nom_decompo['rang_taxonomique'] = $this->attribuerCodeRang($morceau[1]);
$aso_nom_decompo['type_infrasp'] = $morceau[1];
$aso_nom_decompo['nom_infrasp'] = $morceau[2];
$nom_latin = $morceau[4];
$aso_nom_decompo['nom_superieur'] = $aso_nom_decompo['nom_courant'];
$aso_nom_decompo['nom_courant'] = $morceau[2];
} else {// Erreurs
$aso_nom_decompo['erreur_mark'] = 'erreur';
$aso_nom_decompo['erreur_notes'] = $nom_latin;
$nom_latin = '';
}
}
return $aso_nom_decompo;
}
public function verifierTerminaisonLatine($nom_latin)
{
if (preg_match('/^Plantae$/', $nom_latin)) {// Règne
return 10;
} else if (preg_match('/phyta$/', $nom_latin)) {// Embranchement ou Division
return 30;
} else if (preg_match('/phytina$/', $nom_latin)) {// Sous-Embranchement ou Sous-Division
return 40;
} if (preg_match('/opsida$/', $nom_latin)) {// Classe
return 70;
} else if (preg_match('/idae$/', $nom_latin)) {// Sous-Classe
return 80;
} else if (preg_match('/ales$/', $nom_latin)) {// Ordre
return 100;
} else if (preg_match('/ineae$/', $nom_latin)) {// Sous-Ordre
return 110;
} else if (preg_match('/aceae$/', $nom_latin)) {// Famille
return 120;
} else if (preg_match('/oideae$/', $nom_latin)) {// Sous-Famille
return 130;
} else if (preg_match('/eae$/', $nom_latin)) {// Tribu
return 140;
} else if (preg_match('/inae$/', $nom_latin)) {// Sous-Tribu
return 150;
} else if (preg_match('/^[A-Z]/', $nom_latin)) {// Genre
return 160;
} else {
return 1;
}
}
static function fournirTableauAbreviationRang($type = 'tout')
{
$rang_supra_sp = array('subgen.', 'subg.', 'sect.');// l'abréviation du rang est suivi par un nom supra spécifique commençant par une majuscule
$rang_supra_gr = array('gr.');// l'abréviation du rang est suivi par un nom ne commençant pas par une majuscule
$rang_supra_agg = array('agg.');// le nom latin est terminé par l'abréviation du rang
$rang_infra_sp = array( 'subsp.', 'n-subsp.', '[subsp.]', '[n-subsp.]',
'var.', 'nvar.', '[var.]',
'prol.', 'proles', 'n-proles.',
'f.', 'fa', 'fa.', 'forma',
'subvar.', 'convar.',
'cv.', 'Cv.',
'n-f.', 'n-fa', 'n-fa.',
'subf.', 'subfa', 'subfa.');
if ($type == 'supra') {
return $rang_supra_sp;
} else if ($type == 'supra-gr') {
return $rang_supra_gr;
} else if ($type == 'supra-agg') {
return $rang_supra_agg;
} else if ($type == 'infra') {
return $rang_infra_sp;
} else if ($type == 'tout') {
return array_merge($rang_supra_sp, $rang_supra_gr, $rang_supra_agg, $rang_infra_sp);
}
}
 
static function actualiserCodeRang($code_rang)
{
$aso_rang = array( '1' => '10', // Règne
'3' => '20', // Sous-Règne
'5' => '30', // Phylum
'7' => '40', // Sub-Phylum
'9' => '50', // division
'15' => '60', // sous-division
'20' => '70', // classe
'25' => '80', // sous-classe
'30' => '100', // ordre
'35' => '110', // sous-ordre
'40' => '120', // famille
'45' => '130', // sous-famille
'50' => '140', // tribu
'55' => '150', // sous-tribu
'60' => '160', // genre
'62' => '170', // genre hybride (nouveau compatibilité flore Réunion)
'65' => '180', // sous-genre
'65' => '190', // section
'75' => '200', // sous-section
'80' => '210', // série
'85' => '220', // sous-série
'90' => '230', // groupe
'95' => '240', // aggrégat
'100' => '250', // espèce
'102' => '260', // espèce hybride intragénérique
'104' => '260', // espèce hybride intergénérique
'110' => '280', // sous-espèce
'112' => '300', // sous-espèce hybride : hybride entre deux sous-espèces d'une espèce non hybride ; exemple : Polypodium vulgare L. nsubsp. mantoniae (Rothm.) Schidlay (Polypodium vulgare L. subsp. vulgare x Polypodium vulgare L. subsp. prionodes (Aschers.) Rothm.).
'113' => '310', // sous-espèce hybride : sous-espèce d'espèce hybride sans spécification du rang parental (subspecies) (voir ICBN, art. H.12.1).
'114' => '300', // sous-espèce hybride : sous-espèce hybride d'espèce hybride (nothosubspecies) (voir ICBN, art. H.12.1) ; exemple : Mentha x piperita L. nsubsp. piperita (Mentha aquatica L. x Mentha spicata L. subsp. glabrata (Lej. et Court.) Lebeau).
'115' => '300', // sous-espèce hybride
'120' => '1', // infra2
'122' => '330', // prole, race : peu employé souvent issu de nom ancien (antérieur au code).
'124' => '340', // prole, race hybride : peu employé souvent issu de nom ancien (antérieur au code).
'132' => '350', // convarietas : si on le conscidère comme un rang intermédiaire entre la sous-espèce et la variété. Voir aussi n°200.
'130' => '1', // infra3 : niveau infra-spécifique de troisième niveau, sans plus de précision.
'140' => '360', // variété
'142' => '380', // variété : hybride entre deux variétés d'une espèce non hybride.
'143' => '390', // variété : variété d'espèce hybride sans spécification du rang parental (varietas) (voir ICBN, art. H.12.1); exemple : Populus x canadensis Moench var. marilandica (Poir.) Rehder.
'144' => '380', // variété : variété hybride d'espèce hybride (nothovarietas) ; exemple : Salix x sepulcralis Simonk. nvar. chrysocoma (Dode) Meikle.
'145' => '380', // variété hybride
'150' => '410', // sous-variété
'160' => '420', // forme
'162' => '430', // forme : hybride entre deux formes d'une espèce non hybride.
'163' => '430', // forme : forme d'espèce hybride sans spécification du rang parental (forma) (voir ICBN, art. H.12.1); exemple : Mentha x piperita L. f. hirsuta Sole.
'164' => '430', // forme : forme hybride d'espèce hybride (nothoforma).
'170' => '440', // sous-forme
'200' => '450', // groupe de cultivar
'210' => '460', // cultivar
'220' => '470', // cultivar d'hybride
'0' => '480' // clade
);
return $aso_rang[$code_rang];
}
 
public function attribuerCodeInfra($str_abreviation_type_infra)
{
$aso_code_infra = array('type' => '', 'code' => 0, 'rang' => 2 );
switch ($str_abreviation_type_infra) {
case 'subgen.' :
case 'subg.' :
$aso_code_infra['rang'] = 180;
break;
case 'sect.' :
$aso_code_infra['rang'] = 190;
break;
case 'gr.' :
$aso_code_infra['rang'] = 230;
break;
case 'subsp.' :
$aso_code_infra['type'] = 'infra1';
$aso_code_infra['code'] = 1;
$aso_code_infra['rang'] = 280;
break;
case 'n-subsp.' :
$aso_code_infra['type'] = 'infra1';
$aso_code_infra['code'] = 2;
$aso_code_infra['rang'] = 300;
break;
case '[subsp.]' :
$aso_code_infra['type'] = 'infra1';
$aso_code_infra['code'] = 3;
$aso_code_infra['rang'] = 290;
break;
case '[n-subsp.]' :
$aso_code_infra['type'] = 'infra1';
$aso_code_infra['code'] = 4;
$aso_code_infra['rang'] = 310;
break;
case 'var.' :
$aso_code_infra['type'] = 'infra2';
$aso_code_infra['code'] = 1;
$aso_code_infra['rang'] = 360;
break;
case '[var.]' :
$aso_code_infra['type'] = 'infra2';
$aso_code_infra['code'] = 2;
$aso_code_infra['rang'] = 370;
break;
case 'n-var.' :
$aso_code_infra['type'] = 'infra2';
$aso_code_infra['code'] = 3;
$aso_code_infra['rang'] = 380;
break;
case 'nvar.' :
$aso_code_infra['type'] = 'infra2';
$aso_code_infra['code'] = 3;
$aso_code_infra['rang'] = 384;
break;
case '[n-var.]' :
$aso_code_infra['type'] = 'infra2';
$aso_code_infra['code'] = 5;
$aso_code_infra['rang'] = 390;
break;
case 'prol.' :
case 'proles' :
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 2;
$aso_code_infra['rang'] = 330;
break;
case 'n-proles' :
case 'n-proles.' :
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 1;
$aso_code_infra['rang'] = 340;
break;
case 'f.':
case 'fa':
case 'fa.':
case 'forma':
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 3;
$aso_code_infra['rang'] = 420;
break;
case 'subvar.' :
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 4;
$aso_code_infra['rang'] = 410;
break;
case 'convar.' :
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 5;
$aso_code_infra['rang'] = 350;
break;
case 'cv.':
case 'Cv.':
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 6;
$aso_code_infra['rang'] = 460;
break;
case 'n-f.':
case 'n-fa':
case 'n-fa.':
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 7;
$aso_code_infra['rang'] = 430;
break;
case 'subf.':
case 'subfa':
case 'subfa.':
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 8;
$aso_code_infra['rang'] = 440;
break;
default:
$aso_code_infra['erreur_mark'] = 'erreur';
$aso_code_infra['erreur_notes'] = $str_abreviation_type_infra;
$aso_code_infra['rang'] = 2;
}
return $aso_code_infra;
}
public function attribuerCodeRang($str_abreviation_type_infra)
{
$aso_code_infra = $this->attribuerCodeInfra($str_abreviation_type_infra);
return $aso_code_infra['rang'];
}
}
?>
/trunk/scripts/bibliotheque/nom_sci/DecoupageAuteur.php
New file
0,0 → 1,189
<?php
// Encodage : UTF-8
// +-------------------------------------------------------------------------------------------------------------------+
/**
* Découpage des intitulés auteurs
*
* Description : classe permettant de découper les intitulés d'auteurs.
*
//Auteur original :
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Tela-Botanica 1999-2009
* @licence GPL v3 & CeCILL v2
* @version $Id: DecoupageAuteur.class.php 1873 2009-03-31 10:07:24Z Jean-Pascal MILCENT $
*/
// +-------------------------------------------------------------------------------------------------------------------+
class DecoupageAuteur extends Decoupage {
private $expression = array();
private $expression_in = array();
public function __construct()
{
parent::__construct();
$this->expresion[2] = '/^\s*\(([^)]+?)\) ('.$this->Auteur.') ex ('.$this->Auteur.')('.$this->Date.')?\s*$/u';
$this->expresion[3] = '/^\s*\(([^)]+?)\) ('.$this->Auteur.')('.$this->Date.')?\s*$/u';
$this->expresion[5] = '/^\s*('.$this->Auteur.') ex ('.$this->Auteur.')('.$this->Date.')?\s*$/u';
$this->expresion[6] = '/^\s*('.$this->Auteur.')('.$this->Date.')?\s*$/u';
$this->expresion[7] = '/^\s*\(([^)]+?)\) ('.$this->Auteur.'),? ('.$this->ComNom.')\s*$/u';
$this->expresion[8] = '/^\s*\(('.$this->Auteur.') ex ('.$this->Auteur.')\) ('.$this->ComNom.')\s*$/u';
$this->expresion[9] = '/^\s*('.$this->Auteur.') ex ('.$this->Auteur.'),? ('.$this->ComNom.')\s*$/u';
$this->expresion[10] = '/^\s*\(('.$this->Auteur.')\) ('.$this->ComNom.')\s*$/u';
$this->expresion[11] = '/^\s*('.$this->Auteur.'),? ('.$this->ComNom.')\s*$/u';
$this->expresion[12] = '/^\s*('.$this->ComNom.')\s*$/u';
$this->expresion[13] = '/^\s*\(('.$this->Auteur.')\) ('.$this->Auteur.'),? ('.$this->InAut.')\s*$/u';
$this->expresion[14] = '/^\s*\(('.$this->Auteur.') ex ('.$this->Auteur.')\) ('.$this->InAut.')\s*$/u';
$this->expresion[15] = '/^\s*('.$this->Auteur.') ex ('.$this->Auteur.'),? ('.$this->InAut.')\s*$/u';
$this->expresion[16] = '/^\s*\(('.$this->Auteur.')\) ('.$this->InAut.')\s*$/u';
$this->expresion[17] = '/^\s*('.$this->Auteur.') ('.$this->InAut.')\s*$/u';
$this->expresion[18] = '/^\s*('.$this->Auteur.'),? ('.$this->InAut.')\s*$/u';
$this->expresion[19] = '/^\s*('.$this->InAut.')\s*$/u';
$this->expresion_in[1] = '/^\s*[iI]n ('.$this->Auteur.') ?('.$this->ComNom.')?\s*$/u';
$this->expresion_in[2] = '/^\s*[iI]n ('.$this->NumAuteur.') ?('.$this->ComNom.')?\s*$/u';
}
public function decouper($str_intitule)
{
$aso_intitule = array( 'auteur_basio_ex' => '', 'auteur_basio' => '',
'auteur_modif_ex' => '', 'auteur_modif' => '',
'date' => '', 'annee' => '', 'commentaires_nomenclaturaux' => '',
'citation_in_auteur' => '', 'integration_ok' => 1,
'erreur_mark' => '', 'erreur_notes' => '');
if ($str_intitule != '') {
$morceau = array();
//Gestion des intitulés auteurs SANS commentaires nomenclaturaux
if (preg_match($this->expresion[6], $str_intitule, $morceau)) {
$aso_intitule['auteur_basio'] = $morceau[1];
$aso_intitule['date'] = $morceau[2];
$aso_date = $this->decouperDate($aso_intitule['date']);
$aso_intitule['annee'] = $aso_date['annee'];
} else if (preg_match($this->expresion[5], $str_intitule, $morceau)) {
$aso_intitule['auteur_basio_ex'] = $morceau[1];
$aso_intitule['auteur_basio'] = $morceau[2];
$aso_intitule['date'] = $morceau[3];
$aso_date = $this->decouperDate($aso_intitule['date']);
$aso_intitule['annee'] = $aso_date['annee'];
} else if (preg_match($this->expresion[3], $str_intitule, $morceau)) {
$aso_auteur = $this->decouperAuteurEx($morceau[1]);
$aso_intitule{'auteur_basio_ex'} = $aso_auteur['auteur_ex'];
$aso_intitule{'auteur_basio'} = $aso_auteur['auteur'];
$aso_intitule['erreur_mark'] = $aso_auteur['erreur_mark'];
$aso_intitule['erreur_notes'] = $str_intitule;
$aso_intitule{'auteur_modif'} = $morceau[2];
$aso_intitule{'date'} = $morceau[3];
$aso_date = $this->decouperDate($aso_intitule['date']);
$aso_intitule['annee'] = $aso_date['annee'];
} else if (preg_match($this->expresion[2], $str_intitule, $morceau)) {
$aso_auteur = $this->decouperAuteurEx($morceau[1]);
$aso_intitule{'auteur_basio_ex'} = $aso_auteur['auteur_ex'];
$aso_intitule{'auteur_basio'} = $aso_auteur['auteur'];
$aso_intitule['erreur_mark'] = $aso_auteur['erreur_mark'];
$aso_intitule['erreur_notes'] = $str_intitule;
$aso_intitule{'auteur_modif_ex'} = $morceau[2];
$aso_intitule{'auteur_modif'} = $morceau[3];
$aso_intitule{'date'} = $morceau[4];
$aso_date = $this->decouperDate($aso_intitule['date']);
$aso_intitule['annee'] = $aso_date['annee'];
} else if (preg_match($this->expresion[7], $str_intitule, $morceau)) {
// Gestion des intitulés auteurs AVEC commentaires nomenclaturaux
$aso_auteur = $this->decouperAuteurEx($morceau[1]);
$aso_intitule{'auteur_basio_ex'} = $aso_auteur['auteur_ex'];
$aso_intitule{'auteur_basio'} = $aso_auteur['auteur'];
$aso_intitule['erreur_mark'] = $aso_auteur['erreur_mark'];
$aso_intitule['erreur_notes'] = $str_intitule;
$aso_intitule{'auteur_modif'} = $morceau[2];
$aso_intitule{'commentaires_nomenclaturaux'} = $morceau[3];
} else if (preg_match($this->expresion[8], $str_intitule, $morceau)) {
$aso_intitule{'auteur_basio_ex'} = $morceau[1];
$aso_intitule{'auteur_basio'} = $morceau[2];
$aso_intitule{'commentaires_nomenclaturaux'} = $morceau[3];
} else if (preg_match($this->expresion[9], $str_intitule, $morceau)) {
$aso_intitule{'auteur_basio_ex'} = $morceau[1];
$aso_intitule{'auteur_basio'} = $morceau[2];
$aso_intitule{'commentaires_nomenclaturaux'} = $morceau[3];
} else if (preg_match($this->expresion[10], $str_intitule, $morceau)) {
$aso_intitule{'auteur_basio'} = $morceau[1];
$aso_intitule{'commentaires_nomenclaturaux'} = $morceau[2];
} else if (preg_match($this->expresion[11], $str_intitule, $morceau)) {
$aso_intitule{'auteur_basio'} = $morceau[1];
$aso_intitule{'commentaires_nomenclaturaux'} = $morceau[2];
} else if (preg_match($this->expresion[12], $str_intitule, $morceau)) {
$aso_intitule{'commentaires_nomenclaturaux'} = $morceau[1];
} else if (preg_match($this->expresion[13], $str_intitule, $morceau)) {
// Gestion des intitulés auteurs AVEC "in"
$aso_intitule{'auteur_basio'} = $morceau[1];
$aso_intitule{'auteur_modif'} = $morceau[2];
$aso_intitule{'citation_in_auteur'} = $morceau[3];
} else if (preg_match($this->expresion[14], $str_intitule, $morceau)) {
$aso_intitule{'auteur_basio_ex'} = $morceau[1];
$aso_intitule{'auteur_basio'} = $morceau[2];
$aso_intitule{'citation_in_auteur'} = $morceau[3];
} else if (preg_match($this->expresion[15], $str_intitule, $morceau)) {
$aso_intitule{'auteur_basio_ex'} = $morceau[1];
$aso_intitule{'auteur_basio'} = $morceau[2];
$aso_intitule{'citation_in_auteur'} = $morceau[3];
} else if (preg_match($this->expresion[16], $str_intitule, $morceau)) {
$aso_intitule{'auteur_basio'} = $morceau[1];
$aso_intitule{'citation_in_auteur'} = $morceau[2];
} else if (preg_match($this->expresion[17], $str_intitule, $morceau)) {
$aso_intitule{'auteur_basio'} = $morceau[1];
$aso_intitule{'citation_in_auteur'} = $morceau[2];
} else if (preg_match($this->expresion[18], $str_intitule, $morceau)) {
$aso_intitule{'auteur_basio'} = $morceau[1];
$aso_intitule{'citation_in_auteur'} = $morceau[2];
} else if (preg_match($this->expresion[19], $str_intitule, $morceau)) {
$aso_intitule{'citation_in_auteur'} = $morceau[1];
} else {
$aso_intitule['erreur_mark'] = 'erreur';
$aso_intitule['erreur_notes'] .= $str_intitule;
}
}
return $aso_intitule;
}
public function decouperIn($str_intitule)
{
$aso_intitule = array( 'in_intitule_auteur' => '', 'in_commentaire_nomenclatural' => '',
'erreur_mark' => '', 'erreur_notes' => '');
if ($str_intitule != '') {
$morceau = array();
if (preg_match($this->expresion_in[1], $str_intitule, $morceau)) {
$aso_intitule{'in_intitule_auteur'} = $morceau[1];
$aso_intitule{'in_commentaire_nomenclatural'} = $morceau[2];
} else if (preg_match($this->expresion_in[2], $str_intitule, $morceau)) {
$aso_intitule{'in_intitule_auteur'} = $morceau[1];
$aso_intitule{'in_commentaire_nomenclatural'} = $morceau[2];
} else {
$aso_intitule['erreur_mark'] = 'erreur';
$aso_intitule['erreur_notes'] .= $str_intitule;
}
}
return $aso_intitule;
}
private function decouperAuteurEx($chaine) {
$aso_retour = array('auteur_ex' => '', 'auteur' => '', 'erreur_mark' => '', 'erreur_notes' => '');
if (preg_match($this->expresion[5], $chaine, $morceau)) {
$aso_retour['auteur_ex'] = $morceau[1];
$aso_retour['auteur'] = $morceau[2];
} else if (preg_match($this->expresion[6], $chaine, $morceau)) {
$aso_retour['auteur'] = $morceau[1];
} else {
$aso_retour['erreur_mark'] = 'erreur';
$aso_retour['erreur_notes'] = $chaine;
}
return $aso_retour;
}
private function decouperDate($chaine)
{
$aso_retour = array('annee' => '');
if (preg_match('/^\[(\d{4})]\$/', $chaine, $morceau = array())) {
$aso_retour['annee'] = $morceau[1];
}
return $aso_retour;
}
}
?>