Changeset 1313 for cpc/trunk/project/batch/hemicycle/parse_hemicycle.pl
- Timestamp:
- Sep 3, 2010, 12:00:21 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpc/trunk/project/batch/hemicycle/parse_hemicycle.pl
r1303 r1313 84 84 chop $no; 85 85 if ($no) { 86 #print "TEST3 $titre -_- $no\n";86 #print "TEST3 $titre -_- $no\n"; 87 87 $ploi{$titre} = $no; 88 88 } … … 92 92 $string =~ s/<\/?sup>//g; 93 93 $string =~ s/<!--[^A-Z]+-->//g; 94 #Recherche des numéros de de loi 95 while($string =~ /#item#\d+\.?\s*([^#]+)\(n\D+(\d+[^\)]+)\)\s*#\/item#/ig) { 96 # print "TEST1 $1 -_- $2 \n"; 97 $titre = lc $1; 98 $no = $2; 99 savepLoi(); 100 } 94 #Recherche des numéros de loi 101 95 while($string =~ /ordre du jour([^<]+\W(proposition|loi)\W[^<]+)\(n\D+(\d+[^\)]+)\)/ig) { 102 96 if ($1 =~ /#item#/i) { 103 97 next; 104 98 } 105 #print "TEST2 $1 -_- $2 -_- $3\n";99 #print "TEST2 $1 -_- $2 -_- $3\n"; 106 100 $titre = lc $1; 107 101 $no = $3; … … 109 103 savepLoi(); 110 104 } 105 while($string =~ /#item#\d+\.?\s*([^#]+)\(n\D+(\d+[^\)]+)\)\s*#\/item#/ig) { 106 #print "TEST1 $1 -_- $2 \n"; 107 $titre = lc $1; 108 $no = $2; 109 savepLoi(); 110 } 111 111 112 112 sub getProjetLoi { 113 113 $titre_cleaned = $titre = lc shift; 114 return unless ($titre); 115 return $ploi{$titre} if (defined($ploi{$titre})); 116 $intervention = lc shift; 117 foreach $k (keys %ploi) { 118 if ($intervention =~ /$k/i) { 119 $ploi{$titre} = $ploi{$k}; 120 return $ploi{$k}; 121 } 122 } 114 123 return unless ($titre); 115 124 return $ploi{$titre} if (defined($ploi{$titre})); … … 139 148 } 140 149 $out = '{"contexte": "'.$contexte.'", "intervention": "'.$intervention.'", "timestamp": "'.$cpt.'", "date": "'.$date.'", "source": "'.$source.'", "heure":"'.$heure.'", "session": "'.$session.'", '; 141 if (($ploi = getProjetLoi($titre1 )) && $contexte !~ /questions?\sau|ordre\sdu\sjour|nomination|suspension\sde\séance|rappels?\sau\srèglement/i) {150 if (($ploi = getProjetLoi($titre1, $intervention)) && $contexte !~ /questions?\sau|ordre\sdu\sjour|nomination|suspension\sde\séance|rappels?\sau\srèglement/i) { 142 151 $out .= "\"numeros_loi\": \"$ploi\", "; 143 152 }
Note: See TracChangeset
for help on using the changeset viewer.