|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use strict;
|
|
|
use locale;
|
|
|
use utf8;
|
|
|
use XML::Writer;
|
|
|
use XML::Twig;
|
|
|
|
|
|
|
|
|
|
|
|
my $stop = 0;
|
|
|
if ($ARGV[2]){
|
|
|
$stop = $ARGV[2];
|
|
|
print "\nReprendre l'extraction à partir de la discussion id : $ARGV[2]";
|
|
|
}
|
|
|
else{
|
|
|
print "\nExtraction de toutes les discussions";
|
|
|
}
|
|
|
|
|
|
|
|
|
my $signedTags = 1;
|
|
|
my $ligne;
|
|
|
my $etat = "nul";
|
|
|
|
|
|
my $topic;
|
|
|
my $idPage = "";
|
|
|
|
|
|
my $titreDiscu;
|
|
|
my $article;
|
|
|
my $subTyp;
|
|
|
my $traduction = "";
|
|
|
my $projetWP1 = 0;
|
|
|
my $front = "";
|
|
|
my $avertissement = "Some paragraphs of this post may be lacking because of an error during the automatic extraction processing. It is likely that only the last paragraph of the post have been extracted. Please check the original wikicode.";
|
|
|
|
|
|
my $file;
|
|
|
|
|
|
my $msg="";
|
|
|
my $idMsg = 0;
|
|
|
my $idMsg_dsFil = 0;
|
|
|
my $idDiv = 0;
|
|
|
my $nbMots = 0;
|
|
|
my $profMax = 1;
|
|
|
my $levelDiv = 0;
|
|
|
|
|
|
my $DiscTot = 0;
|
|
|
my $DivTot = 0;
|
|
|
my $MsgTot = 0;
|
|
|
my $MotTot = 0;
|
|
|
|
|
|
|
|
|
my $statut="";
|
|
|
my $MemStatut="";
|
|
|
my $utilisateur="";
|
|
|
my @auteurs;
|
|
|
my $date="";
|
|
|
|
|
|
my $nomsg = 0;
|
|
|
my $msgAnteDate = 0;
|
|
|
my $msgNoDate = 0;
|
|
|
my $msgBadUser = 0;
|
|
|
my $msgNoUser = 0;
|
|
|
my %freq;
|
|
|
$freq{"unsigned"} = 0;
|
|
|
$freq{"anonyme"} = 0;
|
|
|
$freq{"bot"} = 0;
|
|
|
|
|
|
my $outie;
|
|
|
my $metadataFile = $ARGV[0];
|
|
|
my $archive = $ARGV[1];
|
|
|
my $dumpDate = $archive;
|
|
|
if ($dumpDate =~ /frwiki\-([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])\-pages\-meta\-current/){
|
|
|
$dumpDate = $1."-".$2."-".$3;
|
|
|
}
|
|
|
|
|
|
my $start_run = time();
|
|
|
my $dir = "wikiDisc".$start_run;
|
|
|
`mkdir $dir`;
|
|
|
|
|
|
open (tableCompte, ">tableCompte\_$dir.csv");
|
|
|
binmode(tableCompte, "utf8");
|
|
|
open (tableAuteurs, ">tableAuteurs\_$dir.csv");
|
|
|
binmode(tableAuteurs, "utf8");
|
|
|
|
|
|
|
|
|
|
|
|
print tableCompte "idno\ttitre\tnbFils\tnbPosts\tnbMots\tprofMax\tnbContributeurs\tnbAnonymes\t\%anonymes\tnbBots\t\%bots\tnbUnsigned\t\%unsigned\tsubTyp\tarticle\tgrade\tart\tgeographie\thistoire\tloisirs\tmedecine\tpolitique\treligion\tsciences\tsociete\tsport\ttechno\ttraduction\tharassment\tarticleChantier\tarticleAssessment\tproblem\tarch\tkeepOrsuppr\tcopy\tWPisNot\tprojet\tWP1project\n";
|
|
|
|
|
|
print tableAuteurs "idno\tauteur\tnbMsg\n";
|
|
|
|
|
|
open (STDOUT, "| tee -ai log$dir.txt");
|
|
|
binmode(STDOUT, "utf8");
|
|
|
|
|
|
my %bots;
|
|
|
open (BOTS, "<listNomsBots.txt") or open (BOTS, "<../listNomsBots.txt") or die "listNomsBots.txt not found";
|
|
|
while (my $bot = <BOTS>) {
|
|
|
chomp $bot;
|
|
|
$bots{$bot}="actif";
|
|
|
}
|
|
|
close (BOTS);
|
|
|
open (BOTS, "<listNomsBotsRetraites.txt") or open (BOTS, "<../listNomsBotsRetraites.txt") or die "listNomsBotsRetraites.txt not found";
|
|
|
while (my $bot = <BOTS>) {
|
|
|
chomp $bot;
|
|
|
$bots{$bot}="retraite";
|
|
|
}
|
|
|
close (BOTS);
|
|
|
|
|
|
my %metas;
|
|
|
my $grade = "na";
|
|
|
my $art = my $geo = my $hist = my $loisirs = my $med = my $politique = my $religion = my $sciences = my $societe = my $sport = my $techno = 0;
|
|
|
my $trad = my $harassment = my $articleChantier = my $articleAssessment = my $problem = my $arch = my $keepOrsuppr = my $copy = my $WPisNot = my $projet = 0;
|
|
|
|
|
|
print "\nchargement des informations des portails";
|
|
|
open (META, "<$metadataFile") or die "$metadataFile not found";
|
|
|
while (my $meta = <META>) {
|
|
|
my $catArt;
|
|
|
chomp $meta;
|
|
|
my @tmp = split("\t",$meta);
|
|
|
if ($tmp[5]>0){
|
|
|
$catArt=$catArt."art,";
|
|
|
}
|
|
|
else {
|
|
|
$catArt=$catArt.",";
|
|
|
}
|
|
|
if ($tmp[6]>0){
|
|
|
$catArt=$catArt."geographie,";
|
|
|
}
|
|
|
else {
|
|
|
$catArt=$catArt.",";
|
|
|
}
|
|
|
if ($tmp[7]>0){
|
|
|
$catArt=$catArt."histoire,";
|
|
|
}
|
|
|
else {
|
|
|
$catArt=$catArt.",";
|
|
|
}
|
|
|
if ($tmp[8]>0){
|
|
|
$catArt=$catArt."loisirs,";
|
|
|
}
|
|
|
else {
|
|
|
$catArt=$catArt.",";
|
|
|
}
|
|
|
if ($tmp[9]>0){
|
|
|
$catArt=$catArt."medecine,";
|
|
|
}
|
|
|
else {
|
|
|
$catArt=$catArt.",";
|
|
|
}
|
|
|
if ($tmp[10]>0){
|
|
|
$catArt=$catArt."politique,";
|
|
|
}
|
|
|
else {
|
|
|
$catArt=$catArt.",";
|
|
|
}
|
|
|
if ($tmp[11]>0){
|
|
|
$catArt=$catArt."religion,";
|
|
|
}
|
|
|
else {
|
|
|
$catArt=$catArt.",";
|
|
|
}
|
|
|
if ($tmp[12]>0){
|
|
|
$catArt=$catArt."sciences,";
|
|
|
}
|
|
|
else {
|
|
|
$catArt=$catArt.",";
|
|
|
}
|
|
|
if ($tmp[13]>0){
|
|
|
$catArt=$catArt."societe,";
|
|
|
}
|
|
|
else {
|
|
|
$catArt=$catArt.",";
|
|
|
}
|
|
|
if ($tmp[14]>0){
|
|
|
$catArt=$catArt."sport,";
|
|
|
}
|
|
|
else {
|
|
|
$catArt=$catArt.",";
|
|
|
}
|
|
|
if ($tmp[15]>0){
|
|
|
$catArt=$catArt."techno,";
|
|
|
}
|
|
|
else {
|
|
|
$catArt=$catArt.",";
|
|
|
}
|
|
|
$metas{$tmp[0]}=$catArt;
|
|
|
}
|
|
|
close (META);
|
|
|
|
|
|
|
|
|
|
|
|
if ($archive =~ /\.xml$/){
|
|
|
open (DUMP, "<$archive") or die "$archive not found";
|
|
|
}
|
|
|
elsif($archive =~ /\.bz2$/){
|
|
|
open (DUMP, "bzcat $archive |") or die "Pb ouverture de $archive\n";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print "\nlecture du dump";
|
|
|
binmode(DUMP, "utf8");
|
|
|
while ($ligne = <DUMP>) {
|
|
|
chomp $ligne;
|
|
|
$ligne =~ s/\r//g;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($etat eq "redirect" or ($ligne =~ /<\/page>/ && $etat ne "nul")){
|
|
|
if ($etat ne "redirect" and $idPage > $stop){
|
|
|
&printMsg;
|
|
|
until (my $e = $outie->current_element eq "TEI"){
|
|
|
$outie->endTag($e);
|
|
|
}
|
|
|
$outie->endTag("TEI");
|
|
|
$outie->end( );
|
|
|
close(outXML);
|
|
|
if ($nbMots > 1 && $idMsg > 0){
|
|
|
|
|
|
|
|
|
open( my $out, '>out.xml');
|
|
|
my $twig = XML::Twig->parse(pretty_print => 'indented', keep_encoding => "true", "outTemp.xml");
|
|
|
my @listDiv = $twig->descendants('div');
|
|
|
foreach my $section (@listDiv){
|
|
|
my @listPost = $section->descendants('post');
|
|
|
my $textInAll = "";
|
|
|
foreach my $post (@listPost){
|
|
|
my @listInPost = $post->descendants();
|
|
|
my $textIn = "";
|
|
|
foreach my $inPost (@listInPost){
|
|
|
my $textInTmp = $inPost->text;
|
|
|
$textIn .= $textInTmp;
|
|
|
$textInAll .= $textIn;
|
|
|
if ($textInTmp eq "" or $textInTmp =~ /^\s+$/){
|
|
|
|
|
|
$inPost -> cut_children;
|
|
|
$inPost -> delete;
|
|
|
}
|
|
|
}
|
|
|
if ($textIn eq "" or $textIn =~ /^\s+$/){
|
|
|
|
|
|
$post -> cut_children;
|
|
|
$post -> delete;
|
|
|
print "\n$idMsg deleted in $file (because empty)";
|
|
|
$idMsg -= 1;
|
|
|
}
|
|
|
}
|
|
|
if ($textInAll eq "" or $textInAll =~ /^\s+$/){
|
|
|
$section -> cut_children;
|
|
|
$section -> delete;
|
|
|
print "\ndiv $idDiv deleted in $file (because empty)";
|
|
|
$idDiv -= 1;
|
|
|
}
|
|
|
}
|
|
|
$twig->print($out);
|
|
|
$twig->purge;
|
|
|
close($out);
|
|
|
|
|
|
if ($idDiv > 0 && $idMsg > 0){
|
|
|
`cp out.xml $dir/$file`;
|
|
|
my $nbUsers = @auteurs;
|
|
|
my $propAnonyme = my $propBot = my $propUnsigned = 0;
|
|
|
if ($freq{"anonyme"} > 0){
|
|
|
$propAnonyme = $freq{"anonyme"}/$idMsg;
|
|
|
}
|
|
|
if ($freq{"bot"} > 0){
|
|
|
$propBot = $freq{"bot"}/$idMsg;
|
|
|
}
|
|
|
if ($freq{"unsigned"} > 0){
|
|
|
$propUnsigned = $freq{"unsigned"}/$idMsg;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
my @portailsArt = split(",",$metas{$idPage});
|
|
|
if ($portailsArt[0] ne ""){$art = 1;}
|
|
|
if ($portailsArt[1] ne ""){$geo = 1;}
|
|
|
if ($portailsArt[2] ne ""){$hist = 1;}
|
|
|
if ($portailsArt[3] ne ""){$loisirs = 1;}
|
|
|
if ($portailsArt[4] ne ""){$med = 1;}
|
|
|
if ($portailsArt[5] ne ""){$politique = 1;}
|
|
|
if ($portailsArt[6] ne ""){$religion = 1;}
|
|
|
if ($portailsArt[7] ne ""){$sciences = 1;}
|
|
|
if ($portailsArt[8] ne ""){$societe = 1;}
|
|
|
if ($portailsArt[9] ne ""){$sport = 1;}
|
|
|
if ($portailsArt[10] ne ""){$techno = 1;}
|
|
|
print tableCompte "$idPage\t$titreDiscu\t$idDiv\t$idMsg\t$nbMots\t$profMax\t$nbUsers\t".$freq{"anonyme"}."\t$propAnonyme\t".$freq{"bot"}."\t$propBot\t".$freq{"unsigned"}."\t$propUnsigned\t$subTyp\t$article\t$grade\t$art\t$geo\t$hist\t$loisirs\t$med\t$politique\t$religion\t$sciences\t$societe\t$sport\t$techno\t$trad\t$harassment\t$articleChantier\t$articleAssessment\t$problem\t$arch\t$keepOrsuppr\t$copy\t$WPisNot\t$projet\t$projetWP1\n";
|
|
|
|
|
|
foreach my $user (@auteurs){
|
|
|
print tableAuteurs "$idPage\t$user\t$freq{$user}\n";
|
|
|
}
|
|
|
print "\n$file created (".$freq{"bot"}." bots)\n";
|
|
|
$DiscTot ++;
|
|
|
$DivTot += $idDiv;
|
|
|
$MsgTot += $idMsg;
|
|
|
$MotTot += $nbMots;
|
|
|
}
|
|
|
else {print "\nno content ($file)";}
|
|
|
`rm out.xml`;
|
|
|
}
|
|
|
else {print "\nno content ($file)";}
|
|
|
}
|
|
|
else {print "\nredirect ($file)";}
|
|
|
|
|
|
`rm outTemp.xml`;
|
|
|
$etat = "nul";
|
|
|
$titreDiscu="";
|
|
|
$topic="";
|
|
|
$idPage ="";
|
|
|
$msg = "";
|
|
|
|
|
|
$idMsg = $idMsg_dsFil = 0;
|
|
|
$idDiv = 0;
|
|
|
$nbMots = 0;
|
|
|
$profMax = 1;
|
|
|
@auteurs = ();
|
|
|
%freq = ();
|
|
|
$freq{"unsigned"} = 0;
|
|
|
$freq{"bot"} = 0;
|
|
|
$freq{"anonyme"} = 0;
|
|
|
$grade = "na";
|
|
|
$art = $geo = $hist = $loisirs = $med = $politique = $religion = $sciences = $societe = $sport = $techno = 0;
|
|
|
$trad = $harassment = $articleChantier = $articleAssessment = $problem = $arch = $keepOrsuppr = $copy = $WPisNot = $projet = $projetWP1 = 0;
|
|
|
$traduction = "";
|
|
|
$front = "";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($ligne =~/<title>Discussion:(.*?)</ and $etat eq "nul"){
|
|
|
$titreDiscu = $1;
|
|
|
$idPage = "";
|
|
|
$etat = "id";
|
|
|
}
|
|
|
|
|
|
elsif ($ligne =~/<id>(\d*)<\/id>/ and $idPage eq "" and $etat eq "id"){
|
|
|
$idPage = $1;
|
|
|
print "\ntraitement de la discussion $titreDiscu ($idPage)\n";
|
|
|
|
|
|
if ($idPage > $stop){
|
|
|
$article = lc ($titreDiscu);
|
|
|
$article =~ s/ç/c/gi;
|
|
|
$article =~ s/[ôöō]/o/gi;
|
|
|
$article =~ s/[îï]/i/gi;
|
|
|
$article =~ s/[âäà]/a/gi;
|
|
|
$article =~ s/[ëêèé]/e/gi;
|
|
|
$article =~ s/[üûùū]/u/gi;
|
|
|
$article =~ s/\//RUBRIK/g;
|
|
|
$article =~ s/[\,\.\s\-\'\\\)\(]/\_/g;
|
|
|
$article =~ s/\&/AND/g;
|
|
|
$article =~ s/\_+/\_/g;
|
|
|
$article =~ s/\_$//;
|
|
|
|
|
|
if ($article =~ /(RUBRIK.\_faire)$/){
|
|
|
$subTyp = "aFaire";
|
|
|
}
|
|
|
elsif ($article =~ /(RUBRIKarticle\_de\_qualit.)$/){
|
|
|
$subTyp = "adq";
|
|
|
}
|
|
|
elsif ($article =~ /(RUBRIKneutralit.)$/){
|
|
|
$subTyp = "npov";
|
|
|
}
|
|
|
elsif ($article =~ /(RUBRIKdroit\_d\_auteur)$/){
|
|
|
$subTyp = "droitAuteur";
|
|
|
}
|
|
|
elsif ($article =~ /(RUBRIKsuppression)$/){
|
|
|
$subTyp = "suppr";
|
|
|
}
|
|
|
elsif ($article =~ /(RUBRIKlumi.re\_sur)$/){
|
|
|
$subTyp = "lumiereSur";
|
|
|
}
|
|
|
elsif ($article =~ /(RUBRIKbon\_article)$/){
|
|
|
$subTyp = "bonArt";
|
|
|
}
|
|
|
elsif ($article =~ /RUBRIKarch/){
|
|
|
$subTyp = "archive";
|
|
|
}
|
|
|
elsif ($article =~ /RUBRIK(.+)$/){
|
|
|
$subTyp = $1;
|
|
|
}
|
|
|
else {
|
|
|
$subTyp = "courante";
|
|
|
}
|
|
|
$article =~ s/^(.+?)RUBRIK.*$/$1/;
|
|
|
|
|
|
$file = $idPage.".xml";
|
|
|
&newTEI($file);
|
|
|
$etat = "start";
|
|
|
}
|
|
|
else {
|
|
|
print "déjà fait";
|
|
|
$etat eq "nul";
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif ( $ligne =~/<text xml:space=\"preserve\">[\|\s]*(\#REDIRECT|Doublon )/i and $etat eq "start"){
|
|
|
|
|
|
$etat = "redirect";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
elsif (($ligne =~/<text xml:space=\"preserve\">[\|\s]*.*?\{\{Wikiprojet\|([^\|]+)\|([^\|]+)\|avancement=([^\}]+)\}\}/i and $etat eq "start") or ($ligne =~/^[\|\s]*\{\{Wikiprojet\|([^\|]+)\|([^\|]+)\|avancement=([^\}]+)\}\}/i and $etat eq "discu")){
|
|
|
|
|
|
$outie->startTag("category", "type"=>"discipline");
|
|
|
$outie->startTag("catDesc");
|
|
|
$outie->characters($1);
|
|
|
$outie->endTag("catDesc");
|
|
|
$outie->endTag("category");
|
|
|
$outie->startTag("category", "type"=>"grade");
|
|
|
$outie->startTag("catDesc");
|
|
|
$grade = $3;
|
|
|
$grade =~ s/^\s//g;
|
|
|
$grade =~ s/\s$//g;
|
|
|
$outie->characters($grade);
|
|
|
$outie->endTag("catDesc");
|
|
|
$outie->endTag("category");
|
|
|
$etat = "discu";
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif (($ligne =~/<text xml:space=\"preserve\">\s*.*?\{\{Wikiprojet/i and $etat eq "start") or ($ligne =~/^\s*\{\{Wikiprojet/i and $etat eq "discu")){
|
|
|
|
|
|
$outie->startTag("category", "type"=>"discipline");
|
|
|
$etat = "cat";
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ( ($ligne =~/\|(.+?)\|([^\}]*)/) and $etat eq "cat"){
|
|
|
|
|
|
if ($ligne =~ /Wikip.dia 1\.0\/Les plus consult.s/i){
|
|
|
$projetWP1 = 1;
|
|
|
}
|
|
|
else{
|
|
|
$outie->startTag("catDesc");
|
|
|
$outie->characters($1);
|
|
|
$outie->endTag("catDesc");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
elsif ($ligne =~ /\| *avancement ?=([^\}]*)/ and $etat eq "cat"){
|
|
|
|
|
|
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
$outie->startTag("category", "type"=>"grade");
|
|
|
$outie->startTag("catDesc");
|
|
|
$grade = $1;
|
|
|
$grade =~ s/^\s//g;
|
|
|
$grade =~ s/\s$//g;
|
|
|
$outie->characters($grade);
|
|
|
$outie->endTag("catDesc");
|
|
|
$outie->endTag("category");
|
|
|
$etat = "discu";
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ($ligne =~/^\s*\}\}/ and ($etat =~/^other/ or $etat eq "cat")){
|
|
|
|
|
|
if ($outie->current_element eq "catDesc"){
|
|
|
$outie->endTag("catDesc");
|
|
|
}
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
$etat = "discu";
|
|
|
}
|
|
|
elsif ($ligne =~/^(.+?)\}\}/ and ($etat =~/^other/ or $etat eq "cat")){
|
|
|
|
|
|
|
|
|
|
|
|
if ($outie->current_element eq "catDesc"){
|
|
|
$outie->characters($1);
|
|
|
$outie->endTag("catDesc");
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
elsif ($outie->current_element eq "category"){
|
|
|
$outie->startTag("catDesc");
|
|
|
$outie->characters($1);
|
|
|
$outie->endTag("catDesc");
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
elsif($etat eq "otherTrad"){
|
|
|
$traduction = $traduction." ".$1;
|
|
|
if ($outie->current_element eq "catDesc"){
|
|
|
$outie->endTag("catDesc");
|
|
|
}
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
}
|
|
|
elsif($etat eq "otherFront"){
|
|
|
$front = $front." ".$1;
|
|
|
if ($outie->current_element eq "catDesc"){
|
|
|
$outie->endTag("catDesc");
|
|
|
}
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
$outie->startTag("category");
|
|
|
$outie->startTag("catDesc", "type"=>"autre");
|
|
|
$outie->characters($1);
|
|
|
$outie->endTag("catDesc");
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
|
|
|
$etat = "discu";
|
|
|
}
|
|
|
|
|
|
elsif ($etat eq "other"){
|
|
|
|
|
|
|
|
|
$outie->characters($ligne);
|
|
|
}
|
|
|
elsif ($etat eq "otherTrad"){
|
|
|
|
|
|
|
|
|
$traduction = $traduction."\n".$ligne;
|
|
|
}
|
|
|
elsif ($etat eq "otherFront"){
|
|
|
|
|
|
|
|
|
$front = $front."\n".$ligne;
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif (($ligne =~/<text xml:space=\"preserve\">[\|\s]*\{\{((Appel au calme|Controvers|Censur).*?)\}\}/i and $etat eq "start") or ($ligne =~/^\s*\{\{((Appel au calme|Controvers|Censur).*?)\}\}/i and $etat eq "discu")){
|
|
|
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
$outie->startTag("category", "type"=>"other", "info"=>"problem");
|
|
|
$outie->startTag("catDesc");
|
|
|
$ligne =~ s/<text xml:space=\"preserve\">//;
|
|
|
$outie->characters($ligne);
|
|
|
$harassment = 1;
|
|
|
$outie->endTag("catDesc");
|
|
|
$outie->endTag("category");
|
|
|
$etat = "discu";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif (($ligne =~/<text xml:space=\"preserve\">[\|\s]*\{\{(.*?)\}\}/ and $etat eq "start") or ($ligne =~/\s*\{\{(.*?)\}\}/ and $etat eq "discu")){
|
|
|
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
|
|
|
$ligne =~ s/<text xml:space=\"preserve\">//;
|
|
|
my @quelAutre = split("\t",&ClassDeclAutre($ligne));
|
|
|
|
|
|
if ($quelAutre[0] eq "trad" && $quelAutre[1]=~/[a-z]/i){
|
|
|
$traduction = $traduction."\n".$quelAutre[1];
|
|
|
$etat = "otherTrad";
|
|
|
|
|
|
}
|
|
|
elsif ($quelAutre[0] eq "post" && $quelAutre[1]=~/[a-z]/i){
|
|
|
$msg = $ligne;
|
|
|
&printMsg;
|
|
|
$etat = "msg";
|
|
|
|
|
|
}
|
|
|
elsif ($quelAutre[0] eq "front" && $quelAutre[1]=~/[a-z]/i){
|
|
|
$front = $front."\n".$quelAutre[1];
|
|
|
$etat = "otherFront";
|
|
|
|
|
|
}
|
|
|
elsif ($quelAutre[1]=~/[a-z]/i){
|
|
|
$outie->startTag("category", "type"=>"other", "info"=>$quelAutre[0]);
|
|
|
$outie->startTag("catDesc");
|
|
|
$outie->characters($quelAutre[1]);
|
|
|
$etat = "other";
|
|
|
|
|
|
}
|
|
|
if ($ligne =~/\}\}\s*$/ && $etat ne "msg"){
|
|
|
if ($outie->current_element eq "catDesc"){
|
|
|
$outie->endTag("catDesc");
|
|
|
}
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
$etat = "discu";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
elsif ((($ligne =~/<text xml:space=\"preserve\">[\|\s]*\{\{(.*)/ and $etat eq "start") or ($ligne =~/\s*\{\{(.*)/ and $1 !~ /^wikidata/i and $etat eq "discu")) and $1 !~/^(user|utilisateur)/i){
|
|
|
|
|
|
|
|
|
|
|
|
if ($outie->current_element eq "catDesc"){
|
|
|
$outie->endTag("catDesc");
|
|
|
}
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
|
|
|
$ligne =~ s/<text xml:space=\"preserve\">//;
|
|
|
|
|
|
my @quelAutre = split("\t",&ClassDeclAutre($ligne));
|
|
|
|
|
|
if ($quelAutre[0] eq "trad" && $quelAutre[1]=~/[a-z]/i){
|
|
|
$traduction = $traduction." ".$quelAutre[1];
|
|
|
$etat = "otherTrad";
|
|
|
|
|
|
}
|
|
|
elsif ($quelAutre[0] eq "post" && $quelAutre[1]=~/[a-z]/i){
|
|
|
$msg = $ligne;
|
|
|
&printMsg;
|
|
|
$etat = "msg";
|
|
|
print "\nnew $quelAutre[0]";
|
|
|
}
|
|
|
elsif ($quelAutre[0] eq "front" && $quelAutre[1]=~/[a-z]/i){
|
|
|
$front = $front." ".$quelAutre[1];
|
|
|
$etat = "otherFront";
|
|
|
print "\nnew $quelAutre[0]";
|
|
|
}
|
|
|
elsif ($quelAutre[1]=~/[a-z]/i){
|
|
|
$outie->startTag("category", "type"=>"other", "info"=>$quelAutre[0]);
|
|
|
$outie->startTag("catDesc");
|
|
|
$outie->characters($quelAutre[1]);
|
|
|
$etat = "other";
|
|
|
print "\nnew $quelAutre[0]";
|
|
|
}
|
|
|
if ($ligne =~/\}\}\s*$/ && $etat ne "msg"){
|
|
|
if ($outie->current_element eq "catDesc"){
|
|
|
$outie->endTag("catDesc");
|
|
|
}
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
$etat = "discu";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
elsif ( $ligne =~/<text xml:space=\"preserve\">/ and $etat eq "start"){
|
|
|
|
|
|
$etat = "discu";
|
|
|
|
|
|
|
|
|
if ($ligne =~/<text xml:space=\"preserve\">[\|\s\{]*\[\[(User|Utilisateur):([^\]]+?)\|(.*?)\]\](.*?)?(CES?T)?.*/i) {
|
|
|
$msg = $ligne;
|
|
|
$msg =~ s/^\s*<text xml:space=\"preserve\">//;
|
|
|
$utilisateur = $4;
|
|
|
&printMsg;
|
|
|
}
|
|
|
|
|
|
elsif ($ligne =~/<text xml:space=\"preserve\">[\|\s]*(=+) *([^=]+?.*?) *(=+)\s*$/) {
|
|
|
$topic = $2;
|
|
|
$idDiv++;
|
|
|
$levelDiv=1;
|
|
|
if ($outie->current_element eq "catDesc"){
|
|
|
$outie->endTag("catDesc");
|
|
|
}
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
if ($projetWP1){
|
|
|
$outie->startTag("category", "type"=>"other", "info"=>"projet");
|
|
|
$outie->dataElement("catDesc", "Wikipédia 1.0/Les plus consultés");
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
$outie->endTag("taxonomy");
|
|
|
$outie->endTag("classDecl");
|
|
|
$outie->endTag("encodingDesc");
|
|
|
$outie->startTag("profileDesc");
|
|
|
$outie->startTag("langUsage");
|
|
|
$outie->startTag("language", "ident"=>"fr");
|
|
|
$outie->characters("french");
|
|
|
$outie->endTag("language");
|
|
|
$outie->endTag("langUsage");
|
|
|
if ($traduction ne ""){
|
|
|
$outie->startTag("textDesc");
|
|
|
$outie->startTag("derivation", "type"=>"translation");
|
|
|
$outie->characters($traduction);
|
|
|
$outie->endTag("derivation");
|
|
|
$outie->endTag("textDesc");
|
|
|
}
|
|
|
$outie->endTag("profileDesc");
|
|
|
$outie->endTag("teiHeader");
|
|
|
$outie->startTag("text");
|
|
|
$outie->startTag("front");
|
|
|
$outie->startTag("titlePage");
|
|
|
$outie->startTag("docTitle");
|
|
|
$outie->characters($titreDiscu);
|
|
|
$outie->endTag("docTitle");
|
|
|
$outie->endTag("titlePage");
|
|
|
if ($front ne ""){
|
|
|
$outie->dataElement("note",$front)
|
|
|
}
|
|
|
$outie->endTag("front");
|
|
|
$outie->startTag("body");
|
|
|
|
|
|
$outie->startTag("div", "type"=>"thread", "id"=>$idDiv, "level"=>$levelDiv);
|
|
|
$outie->startTag("head");
|
|
|
$nbMots += &countMots($topic);
|
|
|
$outie->characters($topic);
|
|
|
$outie->endTag("head");
|
|
|
$etat = "msg";
|
|
|
}
|
|
|
|
|
|
elsif ($ligne =~/<text xml:space=\"preserve\">\s*[^\{]+/) {
|
|
|
$idDiv++;
|
|
|
$levelDiv=1;
|
|
|
if ($outie->current_element eq "catDesc"){
|
|
|
$outie->endTag("catDesc");
|
|
|
}
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
if ($projetWP1){
|
|
|
$outie->startTag("category", "type"=>"other", "info"=>"projet");
|
|
|
$outie->dataElement("catDesc", "Wikipédia 1.0/Les plus consultés");
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
$outie->endTag("taxonomy");
|
|
|
$outie->endTag("classDecl");
|
|
|
$outie->endTag("encodingDesc");
|
|
|
$outie->startTag("profileDesc");
|
|
|
$outie->startTag("langUsage");
|
|
|
$outie->startTag("language", "ident"=>"fr");
|
|
|
$outie->characters("french");
|
|
|
$outie->endTag("language");
|
|
|
$outie->endTag("langUsage");
|
|
|
if ($traduction ne ""){
|
|
|
$outie->startTag("textDesc");
|
|
|
$outie->startTag("derivation", "type"=>"translation");
|
|
|
$outie->characters($traduction);
|
|
|
$outie->endTag("derivation");
|
|
|
$outie->endTag("textDesc");
|
|
|
}
|
|
|
$outie->endTag("profileDesc");
|
|
|
$outie->endTag("teiHeader");
|
|
|
$outie->startTag("text");
|
|
|
$outie->startTag("front");
|
|
|
$outie->startTag("titlePage");
|
|
|
$outie->startTag("docTitle");
|
|
|
$outie->characters($titreDiscu);
|
|
|
$outie->endTag("docTitle");
|
|
|
$outie->endTag("titlePage");
|
|
|
if ($front ne ""){
|
|
|
$outie->dataElement("note",$front)
|
|
|
}
|
|
|
$outie->endTag("front");
|
|
|
$outie->startTag("body");
|
|
|
|
|
|
$outie->startTag("div", "type"=>"thread", "id"=>$idDiv, "level"=>$levelDiv);
|
|
|
$outie->emptyTag("head");
|
|
|
$msg = $ligne;
|
|
|
$msg =~ s/^\s*<text xml:space=\"preserve\">//;
|
|
|
$etat = "msg";
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
elsif ($etat =~ /^wikidataList/ and $ligne =~/{\{Wikidata list end\}\}/){
|
|
|
$etat =~ s/wikidataList_//;
|
|
|
$msg = "Suppression lors de l'extraction de la wikiData list";
|
|
|
&printMsg;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif ( $ligne =~/^\s*(=+) *([^=]+?.*?) *(=+)\s*$/ and $etat eq "discu" and $idDiv==0) {
|
|
|
|
|
|
if ($outie->current_element eq "catDesc"){
|
|
|
$outie->endTag("catDesc");
|
|
|
}
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
if ($projetWP1){
|
|
|
$outie->startTag("category", "type"=>"other", "info"=>"projet");
|
|
|
$outie->dataElement("catDesc", "Wikipédia 1.0/Les plus consultés");
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
$outie->endTag("taxonomy");
|
|
|
$outie->endTag("classDecl");
|
|
|
$outie->endTag("encodingDesc");
|
|
|
$outie->startTag("profileDesc");
|
|
|
$outie->startTag("langUsage");
|
|
|
$outie->startTag("language", "ident"=>"fr");
|
|
|
$outie->characters("french");
|
|
|
$outie->endTag("language");
|
|
|
$outie->endTag("langUsage");
|
|
|
if ($traduction ne ""){
|
|
|
$outie->startTag("textDesc");
|
|
|
$outie->startTag("derivation", "type"=>"translation");
|
|
|
$outie->characters($traduction);
|
|
|
$outie->endTag("derivation");
|
|
|
$outie->endTag("textDesc");
|
|
|
}
|
|
|
$outie->endTag("profileDesc");
|
|
|
$outie->endTag("teiHeader");
|
|
|
$outie->startTag("text");
|
|
|
$outie->startTag("front");
|
|
|
$outie->startTag("titlePage");
|
|
|
$outie->startTag("docTitle");
|
|
|
$outie->characters($titreDiscu);
|
|
|
$outie->endTag("docTitle");
|
|
|
$outie->endTag("titlePage");
|
|
|
if ($front ne ""){
|
|
|
$outie->dataElement("note",$front)
|
|
|
}
|
|
|
$outie->endTag("front");
|
|
|
$outie->startTag("body");
|
|
|
|
|
|
$topic = $2;
|
|
|
$idDiv++;
|
|
|
$idMsg_dsFil=0;
|
|
|
$levelDiv = 1;
|
|
|
|
|
|
$outie->startTag("div", "type"=>"thread", "id"=>$idDiv, "level"=>$levelDiv);
|
|
|
$outie->startTag("head");
|
|
|
$nbMots += &countMots($topic);
|
|
|
$outie->characters($topic);
|
|
|
$outie->endTag("head");
|
|
|
$etat = "msg";
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ($ligne =~/^\s*(=+) *([^=]+?.*?) *(=+)\s*$/ and $etat eq "msg") {
|
|
|
|
|
|
|
|
|
$topic = $2;
|
|
|
&printMsg;
|
|
|
my $tmp1 = $levelDiv;
|
|
|
my $tmp2 = $levelDiv;
|
|
|
$levelDiv=length($1)-1;
|
|
|
if ($levelDiv == 0){$levelDiv++;}
|
|
|
while ($levelDiv <= $tmp1){
|
|
|
$outie->endTag("div");
|
|
|
$tmp1--;
|
|
|
}
|
|
|
$idDiv++;
|
|
|
$idMsg_dsFil=0;
|
|
|
|
|
|
while ($levelDiv > ($tmp2+1)){
|
|
|
$tmp2++;
|
|
|
|
|
|
$outie->startTag("div", "type"=>"thread", "id"=>$idDiv, "level"=>$levelDiv);
|
|
|
$outie->emptyTag("head");
|
|
|
}
|
|
|
|
|
|
$outie->startTag("div", "type"=>"thread", "id"=>$idDiv, "level"=>$levelDiv);
|
|
|
$outie->startTag("head");
|
|
|
$nbMots += &countMots($topic);
|
|
|
$outie->characters($topic);
|
|
|
$outie->endTag("head");
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif ($etat eq "msg" and $ligne =~/^\s*<source/){
|
|
|
|
|
|
$etat eq "source";
|
|
|
}
|
|
|
elsif ($etat eq "source" and $ligne =~/^\s*<\/source/){
|
|
|
|
|
|
$etat eq "msg";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif ($etat eq "msg" and $ligne =~/^\s*\{\{Wikidata list/){
|
|
|
$etat = "wikidataList_msg";
|
|
|
}
|
|
|
elsif ($etat eq "discu" and $ligne =~/^\s*\{\{Wikidata list/){
|
|
|
$etat = "wikidataList_discu";
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ($ligne =~/^(:+)?(.*)\[\[(User|Utilisateur):([^\]]+?)\|(.*?)\]\](.*?)?(CES?T)?/ and ($etat eq "msg" or $etat eq "discu")) {
|
|
|
|
|
|
|
|
|
$statut = $1;
|
|
|
my $utilisateurTmp = $4;
|
|
|
$ligne =~ s/^$statut//;
|
|
|
$ligne =~ s/^ +//;
|
|
|
$ligne =~ s/^\*/<LI\/>/;
|
|
|
|
|
|
if ($statut ne $MemStatut){
|
|
|
my $statutTmp = $statut;
|
|
|
$statut = $MemStatut;
|
|
|
&printMsg;
|
|
|
$statut = $statutTmp;
|
|
|
$msg = $ligne;
|
|
|
}
|
|
|
else {
|
|
|
$msg .= " <CONCAT1/> ".$ligne;
|
|
|
}
|
|
|
|
|
|
$utilisateur = $utilisateurTmp;
|
|
|
&printMsg;
|
|
|
|
|
|
}
|
|
|
|
|
|
elsif ( ($etat eq "msg" or $etat eq "discu") and ($ligne =~/^(:+).*\[\[(User:|Utilisateur:|.*?:Contributions\/)([^\]]+?)\|(.*?)\]\](.*?)?(CES?T)/) ) {
|
|
|
|
|
|
|
|
|
$statut = $1;
|
|
|
$ligne =~ s/^$statut//;
|
|
|
$ligne =~ s/^ +//;
|
|
|
$ligne =~ s/^\*/<LI\/>/;
|
|
|
my $utilisateurTmp = $4;
|
|
|
|
|
|
if ($statut ne $MemStatut){
|
|
|
my $statutTmp = $statut;
|
|
|
$statut = $MemStatut;
|
|
|
&printMsg;
|
|
|
$statut = $statutTmp;
|
|
|
$msg = $ligne;
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
$msg .= " <CONCAT2/> ".$ligne;
|
|
|
}
|
|
|
|
|
|
$utilisateur = $utilisateurTmp;
|
|
|
&printMsg;
|
|
|
}
|
|
|
|
|
|
elsif ($ligne =~/^(:+)?(.*)\[\[(User|Utilisateur):([^\]]+?)\|(.*?)\]\](.*?)?(CES?T)?/ and ($etat eq "msg" or $etat eq "discu")) {
|
|
|
print "20 ($file) non redondant";
|
|
|
|
|
|
$statut = $1;
|
|
|
$ligne =~ s/^$statut//;
|
|
|
$ligne =~ s/^ +//;
|
|
|
$ligne =~ s/^\*/<LI\/>/;
|
|
|
$msg .= " <CONCAT3/> ".$ligne;
|
|
|
$utilisateur = $4;
|
|
|
&printMsg;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif ($ligne =~/^(:+)?(.*)\{\{(non signé2?|unsigned)((\|[^\|\}]+)+)\}\}/ and ($etat eq "msg" or $etat eq "discu")) {
|
|
|
|
|
|
|
|
|
$statut = $1;
|
|
|
my $utilisateurTmp = "unsigned".$4;
|
|
|
print "\n$utilisateurTmp";
|
|
|
$utilisateurTmp =~ s/\|ip=(oui|yes)//;
|
|
|
$ligne =~ s/^$statut//;
|
|
|
$ligne =~ s/^ +//;
|
|
|
$ligne =~ s/^\*/<LI\/>/;
|
|
|
|
|
|
if ($statut ne $MemStatut){
|
|
|
my $statutTmp = $statut;
|
|
|
$statut = $MemStatut;
|
|
|
&printMsg;
|
|
|
$statut = $statutTmp;
|
|
|
$msg = $ligne;
|
|
|
}
|
|
|
else {
|
|
|
$msg .= " <CONCAT1/> ".$ligne;
|
|
|
}
|
|
|
|
|
|
$utilisateur = $utilisateurTmp;
|
|
|
&printMsg;
|
|
|
|
|
|
}
|
|
|
|
|
|
elsif ( ($etat eq "msg" or $etat eq "discu") and ($ligne =~/^(:+).*\{\{(non signé2?|unsigned)((\|[^\|\}]+)+)\}\}/) ) {
|
|
|
|
|
|
|
|
|
$statut = $1;
|
|
|
$ligne =~ s/^$statut//;
|
|
|
$ligne =~ s/^ +//;
|
|
|
$ligne =~ s/^\*/<LI\/>/;
|
|
|
my $utilisateurTmp = "unsigned".$3;
|
|
|
print "\n$utilisateurTmp";
|
|
|
$utilisateurTmp =~ s/\|ip=(oui|yes)//;
|
|
|
|
|
|
if ($statut ne $MemStatut){
|
|
|
my $statutTmp = $statut;
|
|
|
$statut = $MemStatut;
|
|
|
&printMsg;
|
|
|
$statut = $statutTmp;
|
|
|
$msg = $ligne;
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
$msg .= " <CONCAT2/> ".$ligne;
|
|
|
}
|
|
|
|
|
|
$utilisateur = $utilisateurTmp;
|
|
|
&printMsg;
|
|
|
}
|
|
|
|
|
|
elsif ($ligne =~/^(:+)?(.*)\{\{(non signé2?|unsigned)(\|[^\|\}]+)+\}\}/ and ($etat eq "msg" or $etat eq "discu")) {
|
|
|
print "20 ($file) non redondant";
|
|
|
|
|
|
$statut = $1;
|
|
|
$ligne =~ s/^$statut//;
|
|
|
$ligne =~ s/^ +//;
|
|
|
$ligne =~ s/^\*/<LI\/>/;
|
|
|
$msg .= " <CONCAT3/> ".$ligne;
|
|
|
$utilisateur = "unsigned".$4;
|
|
|
$utilisateur =~ s/\|ip=(oui|yes)//;
|
|
|
&printMsg;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif ( $etat eq "discu" and ($ligne =~/^\s*\{\{[^\}]+\}\}\s*\>?\s*$/ or $ligne =~/^\s*[\|\}][\>\}]\s*$/ or $ligne =~/^\s*\<[^\>]+\>\s*$/)) {
|
|
|
|
|
|
next;
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ( $etat eq "msg" and ($ligne =~/^\s*\{\{[^\}]+\}\}\s*\>?\s*$/ or $ligne =~/^\s*[\|\}][^\}]+[\>\}]\s*$/ or $ligne =~/^\s*\<[^\>]+\>\s*$/)) {
|
|
|
|
|
|
next;
|
|
|
}
|
|
|
elsif ($ligne =~/^\s*<sha1>.*?<\/sha1>\s*$/){
|
|
|
next;
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ( ($etat eq "msg" or $etat eq "discu") and ($ligne =~/^----+$/) ) {
|
|
|
|
|
|
|
|
|
&printMsg;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ($ligne =~/^(:+)?(.*?)((\d+) ((jan|f|mar|avr|apr|ma[yi]|juin|jun|jul|juil|ao|ago|aug|se[tp]|o[kc]|nov|d).*?) (20[01]\d)( à \d?\d\:\d\d)) (CES?T)?/ and ($etat eq "msg" or $etat eq "discu")) {
|
|
|
|
|
|
$statut = $1;
|
|
|
$ligne =~ s/^$statut//;
|
|
|
$ligne =~ s/^ +//;
|
|
|
$ligne =~ s/^\*/<LI\/>/;
|
|
|
$msg .= " <CONCAT6/> ".$ligne;
|
|
|
&printMsg;
|
|
|
|
|
|
}
|
|
|
|
|
|
elsif ( ($etat eq "msg" or $etat eq "discu") and ($ligne =~/^(:+)/) ) {
|
|
|
|
|
|
$statut = $1;
|
|
|
$ligne =~ s/^$statut//;
|
|
|
$ligne =~ s/^ +//;
|
|
|
$ligne =~ s/^\*/<LI\/>/;
|
|
|
|
|
|
if ($statut ne $MemStatut){
|
|
|
my $statutTmp = $statut;
|
|
|
$statut = $MemStatut;
|
|
|
&printMsg;
|
|
|
$statut = $statutTmp;
|
|
|
$msg = $ligne;
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
$msg .= " <CONCAT8/> ".$ligne;
|
|
|
}
|
|
|
|
|
|
$MemStatut = $statut;
|
|
|
}
|
|
|
|
|
|
elsif ( ($etat eq "msg" or $etat eq "discu") and ($ligne =~/^[^:]/) and $statut ne "") {
|
|
|
|
|
|
|
|
|
$ligne =~ s/^\*/<LI\/>/;
|
|
|
&printMsg;
|
|
|
$msg = $ligne;
|
|
|
$MemStatut = $statut = "";
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ($etat eq "msg" and $ligne =~/[^\s\-]+/) {
|
|
|
$etat = "msg";
|
|
|
$ligne =~ s/^\*/<LI\/>/;
|
|
|
$msg .= " <CONCAT9/> ".$ligne;
|
|
|
|
|
|
}
|
|
|
elsif ($etat eq "discu" and $idDiv==0 and $ligne =~ /\b\pL+\b/) {
|
|
|
|
|
|
print "\nnew Post\n";
|
|
|
$etat = "msg";
|
|
|
$msg .= " <CONCAT9/> ".$ligne;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
my $end_run = time();
|
|
|
my $run_time = $end_run - $start_run;
|
|
|
print "\nFin de Traitement pour \n $DiscTot discussions, $DivTot sections, $MsgTot messages et $MotTot mots\n";
|
|
|
print "Job took $run_time seconds\n";
|
|
|
|
|
|
close (DUMP);
|
|
|
close (tableCompte);
|
|
|
close (tableAuteurs);
|
|
|
close (STDOUT);
|
|
|
|
|
|
|
|
|
|
|
|
sub printMsg{
|
|
|
if ($etat ne "nul"){
|
|
|
my $tmp = $outie->current_element;
|
|
|
|
|
|
if ($outie->current_element ne "div" and $outie->current_element ne "post" and ($etat ne "msg" or $outie->current_element eq "taxonomy" or $idDiv < 1)){
|
|
|
|
|
|
if ($outie->current_element eq "catDesc"){
|
|
|
$outie->endTag("catDesc");
|
|
|
}
|
|
|
if ($outie->current_element eq "category"){
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
if ($projetWP1){
|
|
|
$outie->startTag("category", "type"=>"other", "info"=>"projet");
|
|
|
$outie->dataElement("catDesc", "Wikipédia 1.0/Les plus consultés");
|
|
|
$outie->endTag("category");
|
|
|
}
|
|
|
$outie->endTag("taxonomy");
|
|
|
$outie->endTag("classDecl");
|
|
|
$outie->endTag("encodingDesc");
|
|
|
$outie->startTag("profileDesc");
|
|
|
$outie->startTag("langUsage");
|
|
|
$outie->startTag("language", "ident"=>"fr");
|
|
|
$outie->characters("french");
|
|
|
$outie->endTag("language");
|
|
|
$outie->endTag("langUsage");
|
|
|
if ($traduction ne ""){
|
|
|
$outie->startTag("textDesc");
|
|
|
$outie->startTag("derivation", "type"=>"translation");
|
|
|
$outie->characters($traduction);
|
|
|
$outie->endTag("derivation");
|
|
|
$outie->endTag("textDesc");
|
|
|
}
|
|
|
$outie->endTag("profileDesc");
|
|
|
$outie->endTag("teiHeader");
|
|
|
$outie->startTag("text");
|
|
|
$outie->startTag("front");
|
|
|
$outie->startTag("titlePage");
|
|
|
$outie->startTag("docTitle");
|
|
|
$outie->characters($titreDiscu);
|
|
|
$outie->endTag("docTitle");
|
|
|
$outie->endTag("titlePage");
|
|
|
if ($front ne ""){
|
|
|
$outie->dataElement("note",$front)
|
|
|
}
|
|
|
$outie->endTag("front");
|
|
|
$outie->startTag("body");
|
|
|
$idDiv++;
|
|
|
$idMsg_dsFil=0;
|
|
|
$levelDiv=1;
|
|
|
|
|
|
$outie->startTag("div", "type"=>"thread", "id"=>$idDiv, "level"=>$levelDiv);
|
|
|
if ($msg =~/^\s*(=+) *([^=]+?.*?) *(=+)\s*$/){
|
|
|
$outie->dataElement("head",$2);
|
|
|
$msg = "";
|
|
|
}
|
|
|
else {
|
|
|
$outie->emptyTag("head");
|
|
|
}
|
|
|
$etat = "msg";
|
|
|
}
|
|
|
|
|
|
elsif ($outie->current_element eq "body" && $levelDiv > 0){
|
|
|
$idDiv++;
|
|
|
|
|
|
$outie->startTag("div", "type"=>"thread", "id"=>$idDiv, "level"=>$levelDiv);
|
|
|
if ($msg =~/^\s*(=+) *([^=]+?.*?) *(=+)\s*$/){
|
|
|
$outie->dataElement("head",$2);
|
|
|
$msg = "";
|
|
|
}
|
|
|
else {
|
|
|
$outie->emptyTag("head");
|
|
|
}
|
|
|
$outie->emptyTag("head");
|
|
|
}
|
|
|
|
|
|
my $bot = my $tmpUser = my $datxt = "";
|
|
|
if ($msg ne ""){
|
|
|
if ($utilisateur eq "" and $msg =~/(\[\[(User:|Utilisateur:|.*?Contributions\/)([^\]]+?)[\|\]])/){
|
|
|
$utilisateur = $3;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif ($utilisateur =~ /^unsigned\|([^\|]+)\|([^\|]+)/){
|
|
|
|
|
|
my $part1 = $1;
|
|
|
my $part2 = $2;
|
|
|
if ($part1 =~ /20[0-2][0-9] . [0-9][0-9]\:[0-9][0-9]/ or $part1 =~ /^[0-9][0-9]\:[0-9][0-9].+?20[0-2][0-9]/){
|
|
|
$datxt = $part1;
|
|
|
$utilisateur = $part2." (unsigned)";
|
|
|
}
|
|
|
elsif ($part2 =~ /20[0-2][0-9] à [0-9][0-9]\:[0-9][0-9]/ or $part2 =~ /^[0-9][0-9]\:[0-9][0-9].+?20[0-2][0-9]/){
|
|
|
$datxt = $part2;
|
|
|
$utilisateur = $part1." (unsigned)";
|
|
|
}
|
|
|
else {
|
|
|
$utilisateur = $part1.$part2." (unsigned)";
|
|
|
}
|
|
|
$freq{"unsigned"}++;
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ($utilisateur =~ /^unsigned\|([^\|]+)/){
|
|
|
|
|
|
$utilisateur = $1." (unsigned)";
|
|
|
$freq{"unsigned"}++;
|
|
|
}
|
|
|
elsif ($utilisateur eq "") {
|
|
|
$utilisateur = "anonyme";
|
|
|
}
|
|
|
|
|
|
$bot = "no";
|
|
|
$tmpUser = $utilisateur;
|
|
|
|
|
|
|
|
|
$utilisateur = $tmpUser;
|
|
|
|
|
|
|
|
|
|
|
|
if ($msg =~/(message d.pos. automatiquement par un robot|ceci est un message automatique).*?((\d+) ((jan|f|mar|avr|apr|ma[yi]|juin|jun|jul|juil|ao|ago|aug|se[tp]|o[kc]|nov|d)[^\s\<]*?) (20[01]\d) ([^<]*?)(\d\d\:\d\d))/ && length($4)<10 && length($7)<4){
|
|
|
$datxt =$2;
|
|
|
my $jour = $3;
|
|
|
my $mois = $4;
|
|
|
my $annee = $6;
|
|
|
my $heure = $8;
|
|
|
if ($jour =~ /^\d$/) {$jour = "0".$jour;}
|
|
|
$date = $annee."-".&norm($mois)."-".$jour."T".$heure;
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ($msg =~/((\d+) ((jan|f|mar|avr|apr|ma[yi]|juin|jun|jul|juil|ao|ago|aug|se[tp]|o[kc]|nov|d)[^\s\<]*?) (20[01]\d) ([^<]*?)(\d\d\:\d\d) \(CES?T\))/ && length($3)<10 && length($6)<4){
|
|
|
$datxt =$1;
|
|
|
my $jour = $2;
|
|
|
my $mois = $3;
|
|
|
my $annee = $5;
|
|
|
my $heure = $7;
|
|
|
if ($jour =~ /^\d$/) {$jour = "0".$jour;}
|
|
|
$date = $annee."-".&norm($mois)."-".$jour."T".$heure;
|
|
|
}
|
|
|
|
|
|
elsif ($msg =~/((\d\d\:\d\d) ((jan|f|mar|avr|apr|ma[yi]|juin|jun|jul|juil|ao|ago|aug|se[tp]|o[kc]|nov|d)[^\s\<]*?) (\d+), (20[01]\d) \(CES?T\))/ && length($3)<10 ){
|
|
|
$datxt =$1;
|
|
|
my $jour = $5;
|
|
|
my $mois = $3;
|
|
|
my $annee = $6;
|
|
|
my $heure = $2;
|
|
|
if ($jour =~ /^\d$/) {$jour = "0".$jour;}
|
|
|
$date = $annee."-".&norm($mois)."-".$jour."T".$heure;
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ($datxt =~/((\d+) ((jan|f|mar|avr|apr|ma[yi]|juin|jun|jul|juil|ao|ago|aug|se[tp]|o[kc]|nov|d)[^\s\<]*?) (20[01]\d) ([^<]*?)(\d\d\:\d\d))/){
|
|
|
my $jour = $2;
|
|
|
my $mois = $3;
|
|
|
my $annee = $5;
|
|
|
my $heure = $7;
|
|
|
if ($jour =~ /^\d$/) {$jour = "0".$jour;}
|
|
|
$date = $annee."-".&norm($mois)."-".$jour."T".$heure;
|
|
|
}
|
|
|
|
|
|
elsif ($datxt =~/((\d\d\:\d\d) ((jan|f|mar|avr|apr|ma[yi]|juin|jun|jul|juil|ao|ago|aug|se[tp]|o[kc]|nov|d)[^\s\<]*?) (\d+), (20[01]\d))/){
|
|
|
my $jour = $5;
|
|
|
my $mois = $3;
|
|
|
my $annee = $6;
|
|
|
my $heure = $2;
|
|
|
if ($jour =~ /^\d$/) {$jour = "0".$jour;}
|
|
|
$date = $annee."-".&norm($mois)."-".$jour."T".$heure;
|
|
|
}
|
|
|
else {
|
|
|
$date = "unknown"
|
|
|
}
|
|
|
|
|
|
|
|
|
$msg =~ s/^\s*:+//;
|
|
|
|
|
|
$msg =~ s/(\s*<CONCAT([0-9])?\/>)+/<CONCAT\/>/g;
|
|
|
|
|
|
$msg =~ s/\[\[.*?Contributions\/.*?\]\]//;
|
|
|
$msg =~ s/\(?\[\[Discussion utilisateur:[^\]]+(\|.*?)?\]\]\)?//ig;
|
|
|
|
|
|
$msg =~ s/^\s+//;
|
|
|
$msg =~ s/\t//g;
|
|
|
$msg =~ s/<\/text>//;
|
|
|
|
|
|
|
|
|
|
|
|
my $level = 0;
|
|
|
while ($statut =~ /^\:/){
|
|
|
$level++;
|
|
|
$statut =~ s/^\://;
|
|
|
}
|
|
|
if ($level > $profMax){$profMax = $level;}
|
|
|
|
|
|
|
|
|
if ($msg ne "" && $msg !~ /^\s*\-*\s*<CONCAT\/>\s*\-*\s*$/){
|
|
|
$idMsg++;
|
|
|
$idMsg_dsFil++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($msg =~ /message d.pos. automatiquement par (un|le) (ro)?bot/i or $bots{$utilisateur} or $msg =~ /ceci est un message automatique/i){
|
|
|
|
|
|
$outie->startTag("post", "id"=>$idMsg, "who" => "bot", "when" => $date, "indentLevel" => $level, "num" => $idMsg_dsFil);
|
|
|
$bot = "yes";
|
|
|
}
|
|
|
|
|
|
else{
|
|
|
$outie->startTag("post", "id"=>$idMsg, "who" => $utilisateur, "when" => $date, "indentLevel" => $level, "num" => $idMsg_dsFil);
|
|
|
}
|
|
|
|
|
|
|
|
|
my $idP=0;
|
|
|
my @segs = split("<CONCAT/>",$msg);
|
|
|
my $list = 0;
|
|
|
foreach my $seg (@segs){
|
|
|
|
|
|
if ($seg =~/^\s*\-+\s*$/){
|
|
|
|
|
|
}
|
|
|
elsif ($seg =~ /^ *<LI\/>(.*)$/){
|
|
|
$seg = $1;
|
|
|
$seg = &cleanSeg($seg);
|
|
|
$nbMots += &countMots($seg);
|
|
|
if ($list){
|
|
|
$idP++;
|
|
|
$outie->startTag("item", "id"=>$idP);
|
|
|
}
|
|
|
else{
|
|
|
$outie->startTag("list");
|
|
|
$idP++;
|
|
|
$outie->startTag("item", "id"=>$idP);
|
|
|
$list = 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
elsif ($seg !~ /^[\n\s]+$/ and $seg ne "<CONCAT/>"){
|
|
|
if ($list){
|
|
|
$outie->endTag("list");
|
|
|
$list = 0;
|
|
|
}
|
|
|
if ($seg ne ""){
|
|
|
$seg = &cleanSeg($seg);
|
|
|
$nbMots += &countMots($seg);
|
|
|
$idP++;
|
|
|
$outie->startTag("p", "id"=>$idP);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
my $datxtBIS = $datxt;
|
|
|
$datxtBIS =~ s/([\[\]\-\:\(\)])/\\$1/g;
|
|
|
my $utilisateurBIS = $utilisateur;
|
|
|
$utilisateurBIS =~ s/([\{\}\[\]\-\:\(\)\?\!\*\+\^\.\|\&\$])/\\$1/g;
|
|
|
|
|
|
|
|
|
|
|
|
if ($signedTags && $seg =~ /^(.*)ZZZnote-type-unsigned\_([^\_]+)\_noteZZZ(.*)$/ && $utilisateur ne "anonyme"){
|
|
|
|
|
|
my $tmpTxt = $1;
|
|
|
my $tmpIn = $2;
|
|
|
my $tmpTail = $3;
|
|
|
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTxt);
|
|
|
|
|
|
$outie->startTag("note", "type"=>"unsigned");
|
|
|
$outie->characters($tmpIn);
|
|
|
$outie->endTag("note");
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTail);
|
|
|
|
|
|
|
|
|
}
|
|
|
elsif ($signedTags && $seg =~ /^(.*)RRR\_([^\_]+)\_RRR $utilisateurBIS(.+?)$datxtBIS(.*)$/ && $utilisateur ne "anonyme" && $datxt ne ""){
|
|
|
|
|
|
|
|
|
my $tmpTxt = $1;
|
|
|
my $tmpIn1 = $2;
|
|
|
my $tmpIn2 = $3;
|
|
|
my $tmpTail = $4;
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTxt);
|
|
|
|
|
|
$outie->startTag("signed");
|
|
|
my $target="https://fr.wikipedia.org/wiki/".$tmpIn1;
|
|
|
$outie->startTag("ref", "target"=>$target);
|
|
|
$outie->startTag("name");
|
|
|
$outie->characters($utilisateur);
|
|
|
$outie->endTag("name");
|
|
|
$outie->endTag("ref");
|
|
|
$outie->characters($tmpIn2);
|
|
|
$outie->startTag("date");
|
|
|
$outie->characters($datxt);
|
|
|
$outie->endTag("date");
|
|
|
$outie->endTag("signed");
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTail);
|
|
|
|
|
|
}
|
|
|
elsif ($signedTags && $seg =~ /^(.*)RRR\_(Utilisateur|User):$utilisateurBIS\_RRR(.+?)$datxtBIS(.*)$/ && $utilisateur ne "anonyme" && $datxt ne ""){
|
|
|
|
|
|
my $tmpTxt = $1;
|
|
|
my $tmpIn = $3;
|
|
|
my $tmpTail = $4;
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTxt);
|
|
|
|
|
|
$outie->startTag("signed");
|
|
|
my $target="https://fr.wikipedia.org/wiki/".$utilisateur;
|
|
|
$outie->startTag("ref", "target"=>$target);
|
|
|
$outie->startTag("name");
|
|
|
$outie->characters($utilisateur);
|
|
|
$outie->endTag("name");
|
|
|
$outie->endTag("ref");
|
|
|
$outie->characters($tmpIn);
|
|
|
$outie->startTag("date");
|
|
|
$outie->characters($datxt);
|
|
|
$outie->endTag("date");
|
|
|
$outie->endTag("signed");
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTail);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ($signedTags && $seg =~ /^(.*)$utilisateurBIS RRR\_([^\_]+)\_RRR(.+?)$datxtBIS(.*)$/ && $1!~ /ZZZname\-type\-.+?\_$/ && $utilisateur ne "anonyme" && $datxt ne ""){
|
|
|
|
|
|
my $tmpTxt = $1;
|
|
|
my $tmpIn1 = $2;
|
|
|
my $tmpIn2 = $3;
|
|
|
my $tmpTail = $4;
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTxt);
|
|
|
|
|
|
$outie->startTag("signed");
|
|
|
my $target="https://fr.wikipedia.org/wiki/".$tmpIn1;
|
|
|
$outie->startTag("ref", "target"=>$target);
|
|
|
$outie->startTag("name");
|
|
|
$outie->characters($utilisateur);
|
|
|
$outie->endTag("name");
|
|
|
$outie->endTag("ref");
|
|
|
$outie->characters($tmpIn2);
|
|
|
$outie->startTag("date");
|
|
|
$outie->characters($datxt);
|
|
|
$outie->endTag("date");
|
|
|
$outie->endTag("signed");
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTail);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
elsif ($signedTags && $seg =~ /^(.*)$utilisateurBIS(.+?)$datxtBIS(.*)$/ && $1!~ /ZZZname\-type\-.+?\_$/ && $utilisateur ne "anonyme" && $datxt ne ""){
|
|
|
|
|
|
|
|
|
my $tmpTxt = $1;
|
|
|
my $tmpIn = $2;
|
|
|
my $tmpTail = $3;
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTxt);
|
|
|
|
|
|
$outie->startTag("signed");
|
|
|
$outie->startTag("name");
|
|
|
$outie->characters($utilisateur);
|
|
|
$outie->endTag("name");
|
|
|
$outie->characters($tmpIn);
|
|
|
$outie->startTag("date");
|
|
|
$outie->characters($datxt);
|
|
|
$outie->endTag("date");
|
|
|
$outie->endTag("signed");
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTail);
|
|
|
|
|
|
}
|
|
|
|
|
|
elsif ($signedTags && $seg =~ /^(.*)RRR\_([^\_]+)\_RRR $utilisateurBIS(.*)$/ && $utilisateur ne "anonyme"){
|
|
|
|
|
|
my $tmpTxt = $1;
|
|
|
my $tmpIn = $2;
|
|
|
my $tmpTail = $3;
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTxt);
|
|
|
|
|
|
$outie->startTag("signed");
|
|
|
my $target="https://fr.wikipedia.org/wiki/".$tmpIn;
|
|
|
$outie->startTag("ref", "target"=>$target);
|
|
|
$outie->startTag("name");
|
|
|
$outie->characters($utilisateur);
|
|
|
$outie->endTag("name");
|
|
|
$outie->endTag("ref");
|
|
|
$outie->endTag("signed");
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTail);
|
|
|
|
|
|
}
|
|
|
elsif ($signedTags && $seg =~ /^(.*)RRR\_(Utilisateur|User):$utilisateurBIS\_RRR(.*)$/ && $utilisateur ne "anonyme"){
|
|
|
|
|
|
my $tmpTxt = $1;
|
|
|
my $tmpTail = $3;
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTxt);
|
|
|
|
|
|
$outie->startTag("signed");
|
|
|
my $target="https://fr.wikipedia.org/wiki/".$utilisateur;
|
|
|
$outie->startTag("ref", "target"=>$target);
|
|
|
$outie->startTag("name");
|
|
|
$outie->characters($utilisateur);
|
|
|
$outie->endTag("name");
|
|
|
$outie->endTag("ref");
|
|
|
$outie->endTag("signed");
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTail);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
elsif ($signedTags && $seg =~ /^(.*)$utilisateurBIS(.*)$/ && $1!~ /ZZZname\-type\-.+?\_$/ && $utilisateur ne "anonyme"){
|
|
|
|
|
|
my $tmpTxt = $1;
|
|
|
my $tmpTail = $2;
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTxt);
|
|
|
|
|
|
$outie->startTag("signed");
|
|
|
$outie->startTag("name");
|
|
|
$outie->characters($utilisateur);
|
|
|
$outie->endTag("name");
|
|
|
$outie->endTag("signed");
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTail);
|
|
|
}
|
|
|
elsif ($signedTags && $seg =~ /^(.*)$datxtBIS(.*)$/ && $datxt ne ""){
|
|
|
|
|
|
my $tmpTxt = $1;
|
|
|
my $tmpTail = $2;
|
|
|
&detectNoteEmoAddress($tmpTxt);
|
|
|
|
|
|
$outie->startTag("signed");
|
|
|
$outie->startTag("date");
|
|
|
$outie->characters($datxt);
|
|
|
$outie->endTag("date");
|
|
|
$outie->endTag("signed");
|
|
|
|
|
|
&detectNoteEmoAddress($tmpTail);
|
|
|
}
|
|
|
else {
|
|
|
&detectNoteEmoAddress($seg);
|
|
|
}
|
|
|
|
|
|
if ($outie->current_element() eq "item"){
|
|
|
$outie->endTag("item");
|
|
|
}
|
|
|
elsif ($outie->current_element() eq "p") {
|
|
|
$outie->endTag("p");
|
|
|
}
|
|
|
}
|
|
|
if ($list){
|
|
|
$outie->endTag("list");
|
|
|
$list = 0;
|
|
|
}
|
|
|
$outie->endTag("post");
|
|
|
|
|
|
if ($bot eq "yes"){
|
|
|
$freq{"bot"}++;
|
|
|
}
|
|
|
|
|
|
if ($freq{$utilisateur}) {
|
|
|
$freq{$utilisateur}++;
|
|
|
}
|
|
|
else {
|
|
|
$freq{$utilisateur} = 1;
|
|
|
push @auteurs, $utilisateur;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
elsif ($msg ne ""){
|
|
|
$nomsg++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$msg = "";
|
|
|
$date = "";
|
|
|
$utilisateur = "";
|
|
|
$etat="msg";
|
|
|
$statut="";
|
|
|
$MemStatut = "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
sub countMots {
|
|
|
my $n = 0;
|
|
|
my $ligne = shift;
|
|
|
while ( $ligne =~ /(\w+)/ ) {
|
|
|
$n++;
|
|
|
$ligne =~ s/$1//;
|
|
|
}
|
|
|
return $n;
|
|
|
}
|
|
|
|
|
|
sub newTEI {
|
|
|
open(outXML, ">outTemp.xml");
|
|
|
$outie = new XML::Writer (ENCODING=>"UTF-8", DATA_MODE=>0, DATA_INDENT=> 2 , OUTPUT => \*outXML);
|
|
|
$outie->xmlDecl("UTF-8");
|
|
|
$outie->startTag("TEI");
|
|
|
$outie->startTag("teiHeader");
|
|
|
$outie->startTag("fileDesc");
|
|
|
$outie->startTag("titleStmt");
|
|
|
$outie->startTag("title");
|
|
|
$outie->characters($file);
|
|
|
$outie->endTag("title");
|
|
|
$outie->dataElement("bibl", "Ho-Dac, L.-M. and Laippala V. (2017) Le corpus WikiDisc : ressource pour la caractérisation des discussions en ligne. In Wigham, Ciara R.; Ledegen, Gudrun (eds). Corpus de communication médiée par les réseaux : construction, structuration, analyse., l'Harmattan, pp.107-124, ISBN 978-2-343-11212-1. idHal : halshs-01488029");
|
|
|
$outie->startTag("respStmt");
|
|
|
$outie->dataElement("resp", "récupération du fichier depuis la sauvegarde globale et encodage la TEI P5");
|
|
|
$outie->dataElement("name", "Lydia-Mai Ho-Dac");
|
|
|
$outie->dataElement("email", "hodac_at_univ-tlse2.fr");
|
|
|
$outie->endTag("respStmt");
|
|
|
$outie->startTag("sponsor");
|
|
|
$outie->dataElement("orgName", "CORLI");
|
|
|
$outie->dataElement("note", "Le consortium CORLI est né du rapprochement des deux consortiums de linguistique de la TGIR Huma-Num : Corpus Écrits et Corpus Oraux et Multimodaux (IRCOM). Leurs membres ont souhaité poursuivre leurs activités dans le cadre d’un nouveau programme scientifique autour des notions de Langues, Corpus et Interactions. Le consortium CORLI est porté par l’Institut de Linguistique Française (CNRS – FR 2393)");
|
|
|
$outie->endTag("sponsor");
|
|
|
$outie->endTag("titleStmt");
|
|
|
$outie->startTag("publicationStmt");
|
|
|
$outie->startTag("publisher");
|
|
|
$outie->dataElement("orgName", "CLLE-ERSS");
|
|
|
$outie->startTag("address");
|
|
|
$outie->dataElement("street", "5 Allées A. Machado");
|
|
|
$outie->dataElement("postCode", "31058");
|
|
|
$outie->dataElement("settlement", "Toulouse Cedex 9");
|
|
|
$outie->endTag("address");
|
|
|
$outie->endTag("publisher");
|
|
|
my $localTime = localtime();
|
|
|
$outie->emptyTag("date", "when"=>$localTime);
|
|
|
$outie->startTag("availability");
|
|
|
$outie->startTag("licence", "target"=>"http://creativecommons.org/licenses/by-sa/3.0/");
|
|
|
$outie->dataElement("p", "Following Wikipedia.fr recommendation this corpus (and all its related contents) can be freely distributed and shared subject only to attribution, and share alike. How to reference / cite this contents is given in the titleSmt");
|
|
|
$outie->endTag("licence");
|
|
|
$outie->endTag("availability");
|
|
|
$outie->endTag("publicationStmt");
|
|
|
$outie->startTag("sourceDesc");
|
|
|
$outie->startTag("biblStruct");
|
|
|
$outie->startTag("analytic");
|
|
|
$outie->dataElement("author","Wikipedia");
|
|
|
$outie->dataElement("title","Discussion:".$titreDiscu);
|
|
|
$outie->dataElement("idno",$idPage,"type"=>"Wikipedia");
|
|
|
$outie->endTag("analytic");
|
|
|
$outie->startTag("monogr");
|
|
|
$outie->dataElement("title","Wikipedia");
|
|
|
$outie->startTag("imprint");
|
|
|
$outie->dataElement("date",$dumpDate);
|
|
|
$outie->dataElement("publisher","Wikipedia");
|
|
|
$outie->dataElement("pubPlace","http://dumps.wikimedia.org/frwiki/".$archive);
|
|
|
$outie->endTag("imprint");
|
|
|
$outie->endTag("monogr");
|
|
|
$outie->endTag("biblStruct");
|
|
|
$outie->endTag("sourceDesc");
|
|
|
$outie->startTag("notesStmt");
|
|
|
$outie->startTag("note");
|
|
|
my $tmp="associated with the French Wikipedia article ";
|
|
|
if ($subTyp =~ /courante/){
|
|
|
$tmp="This text is the current (".$dumpDate.") talk page ".$tmp;
|
|
|
}
|
|
|
elsif ($subTyp =~ /archive/){
|
|
|
$tmp="This text is an archive of a current talk page ".$tmp;
|
|
|
}
|
|
|
else {
|
|
|
$tmp="This text is a parallel talk page (".$subTyp.")" .$tmp;
|
|
|
}
|
|
|
$outie->characters($tmp);
|
|
|
$outie->dataElement("name", $article, "type"=>"article");
|
|
|
$outie->endTag("note");
|
|
|
$outie->endTag("notesStmt");
|
|
|
$outie->endTag("fileDesc");
|
|
|
$outie->startTag("encodingDesc");
|
|
|
$outie->startTag("projectDesc");
|
|
|
$outie->endTag("projectDesc");
|
|
|
$outie->startTag("classDecl");
|
|
|
$outie->startTag("taxonomy");
|
|
|
$outie->dataElement("bibl","All the category informations are those occurring in the header of the talk page");
|
|
|
$outie->startTag("category", "type"=>"genre");
|
|
|
$outie->startTag("catDesc", "type"=>"main");
|
|
|
$outie->characters("discussion");
|
|
|
$outie->endTag("catDesc");
|
|
|
$outie->startTag("catDesc", "type"=>"sub");
|
|
|
$outie->characters("Wikipedia talk page");
|
|
|
$outie->endTag("catDesc");
|
|
|
$outie->endTag("category");
|
|
|
$outie->startTag("category", "type"=>"Wikipedia article portal");
|
|
|
$outie->startTag("catDesc");
|
|
|
$outie->characters($metas{$idPage});
|
|
|
$outie->endTag("catDesc");
|
|
|
$outie->endTag("category");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub detectNoteEmoAddress {
|
|
|
my $tmp = shift;
|
|
|
while ($tmp =~ /^(.*?)ZZZ(q|note|hi|name|emoticone)(\-(.+?))(\-(.+?))\_(.+?)\_\2ZZZ(.*)$/){
|
|
|
$outie->characters($1);
|
|
|
my $tagSouSeg = $2;
|
|
|
$outie->startTag($tagSouSeg, $4=>$6);
|
|
|
my $souSeg = $7;
|
|
|
$tmp = $8;
|
|
|
print "\tNEwXMLtags: $tagSouSeg (",substr($souSeg, 0, 15),")...";
|
|
|
|
|
|
while ($souSeg =~ /^(.*?)ZZZ(q|note|hi|name|emoticone)(\-(.+?))(\-(.+?))\_(.+?)\_\2ZZZ(.*)$/){
|
|
|
print ", $2 (",substr($7, 0, 15),")...";
|
|
|
$outie->characters($1);
|
|
|
$outie->startTag($2, $4=>$6);
|
|
|
my $souSouSeg = $7;
|
|
|
$souSeg = $8;
|
|
|
while ($souSouSeg =~ /^(.*?)ZZZ(q|note|hi|name|emoticone)(\-(.+?))(\-(.+?))\_(.+?)\_\2ZZZ(.*)$/){
|
|
|
print ", $2 (",substr($7, 0, 15),")...";
|
|
|
$outie->characters($1);
|
|
|
$outie->startTag($2, $4=>$6);
|
|
|
$outie->characters($7);
|
|
|
$outie->endTag($2);
|
|
|
$souSouSeg = $8;
|
|
|
}
|
|
|
$outie->characters($souSouSeg);
|
|
|
$outie->endTag($2);
|
|
|
}
|
|
|
$outie->characters($souSeg);
|
|
|
$outie->endTag($tagSouSeg);
|
|
|
}
|
|
|
$outie->characters($tmp);
|
|
|
}
|
|
|
|
|
|
|
|
|
sub cleanSeg {
|
|
|
my $tmp = shift;
|
|
|
|
|
|
|
|
|
|
|
|
$tmp=~ s/\{\{(non signé2?(\|[^\|]+)+)\}\}/ZZZnote-type-unsigned_$1_noteZZZ/g;
|
|
|
|
|
|
$tmp=~ s/\[\[(Utilisateur:[^\]\|]+?)\|([^\]]*?)\]\]/RRR_$1_RRR $2/g;
|
|
|
$tmp=~ s/\[\[(User:[^\]\|]+?)\|([^\]]*?)\]\]/RRR_$1_RRR $2/g;
|
|
|
|
|
|
$tmp=~ s/\[\[Mod.le?:([^\]\|]+?)\]\]/ZZZnote-type-WikipediaModel_$1_noteZZZ/g;
|
|
|
$tmp=~s/\{\{m\|([^\|\}]+?)\}\}/ZZZnote-type-WikipediaModel_$1_noteZZZ/g;
|
|
|
|
|
|
$tmp=~s/\{\{(\{1\}|censur[eé]|controvers[eé]|c[eé]|conflit d\'[ée]dition)\}\}/ZZZnote-type-WikipediaModel_$1_noteZZZ/g;
|
|
|
$tmp=~s/\{\{((non ?)Résolu)\|([^\}])+\}\}/ZZZnote-type-WikipediaModel_$1_noteZZZ$2/gi;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tmp=~s/\{\{(\?\?\?|ange|bisou|bonjour|clin|\;\)|cool|CQFD|espi[eéèê]gle|coquin|\;p|euh \?|\!\?|fier|g[eêé]n[eé]|f[aâ]ch[eé]|grr|oups|mdr|lol|\=D|dr[oô]le|rire|\^\^|rofl|malin|merci|pleure|bouh|sourire|\=\)|surprise|\=o|tire langue|\=P|triste|=\(|bof|boudeur|expert|\=\/|hum|ampoule|amour|Smiley marronnier|bravo|pendlg|conf|plr|yeux|beurk|[eé]nerv[eé]|rougir|sifflote|applau|B[aâ]ille|Troll3|confus|youpi|dans le mur|ennui|attend|malade|Gnii|Injure|h[eé] h[eé]|Gnii2|N\'importe quoi|Je r[eêè]ve|Ah Ah|Blll|2 cents|boulet|R\-[eèé]|d[ée]sespoir|Fiesta|Hic)(\|[0-9]+)?\}\}/ZZZemoticone-type-tango project_$1_emoticoneZZZ/ig;
|
|
|
$tmp=~s/\{\{(Smirc|Cabale[Alien)\|([^\|\}]+?)(\|[0-9]+)?\}\}/ZZZemoticone-type-$1_$2_emoticoneZZZ/ig;
|
|
|
$tmp=~s/\{\{emoji\|([^\|\}]+?)((\|theme=[^\|\}]+)|(\|taille=[0-9]+))*\}\}/ZZZemoticone-type-emoji_$1_emoticoneZZZ/ig;
|
|
|
|
|
|
$tmp=~s/\{\{([^0-9\|\}]+?)?\}\}/ZZZnote-type-WikipediaModel_$1_noteZZZ/g;
|
|
|
|
|
|
$tmp=~s/\{\{(u\-?|U\/s|U\-simple)\|([^\|\}]+?)(\|(lang=|\\=sous\-page|caption=)+)*\}\}/ZZZname-type-user_$2_nameZZZ/ig;
|
|
|
$tmp=~s/\{\{(notif|notif discret|notif invisible|notif[\-|d]|n\-|notifinv|mention)\|([^\|\}]+?)(\|[^\s\|\}]+)*\}\}/ZZZname-type-notif_$2_nameZZZ/ig;
|
|
|
$tmp=~s/\{\{(bonjour|bonsoir|bienvenue|merci)\|([^\|\}]+?)\}\}/ZZZname-type-$1_$2_nameZZZ/ig;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tmp=~s/\{\{incise\|([^\|\}]+?)\}\}/ZZZnote-type-incise_$1_noteZZZ/ig;
|
|
|
$tmp=~s/\{\{(citation( bloc)?)\|([^\|\}]+?)\}\}/ZZZq-type-$1_$3_qZZZ/ig;
|
|
|
|
|
|
$tmp=~s/\&\#39;/\'/g;
|
|
|
|
|
|
|
|
|
while ($tmp =~ /\'\'\'([^\']+)\'\'\'/ and $1 !~/(ZZZ|RRR|\(CES?T\))/){
|
|
|
$tmp=~ s/\'\'\'([^\']+)\'\'\'/ZZZhi-rend-bold_$1_hiZZZ/;
|
|
|
}
|
|
|
while ($tmp =~ /\"\'([^\']+)\"\'/ and $1 !~/(ZZZ|RRR|\(CES?T\))/){
|
|
|
$tmp=~ s/\"\'([^\']+)\"\'/ZZZhi-rend-bold_$1_hiZZZ/;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$tmp=~ s/\[\[([^\]\|]+?)\|([^\]]*?)\]\]/$2/g;
|
|
|
|
|
|
$tmp=~ s/\'\'/\"/g;
|
|
|
$tmp=~ s/\'\'\'//g;
|
|
|
$tmp=~ s/\'\'//g;
|
|
|
$tmp=~ s/\<u\/?\>//ig;
|
|
|
$tmp=~ s/\<\/?small\>//ig;
|
|
|
|
|
|
$tmp=~ s/\< *br *\>//gi;
|
|
|
$tmp=~ s/\"/\"/gi;
|
|
|
|
|
|
|
|
|
$tmp=~s/\</</g;
|
|
|
$tmp=~s/\>/>/g;
|
|
|
$tmp=~s/\&\w+;//g;
|
|
|
$tmp=~s/\&[x#]+\d+;//g;
|
|
|
|
|
|
$tmp=~ s/<.*?>//g;
|
|
|
$tmp=~ s/[\[\]<>]//g;
|
|
|
$tmp=~ s/[\{\}]//g;
|
|
|
$tmp=~ s/#(:+)? ?//g;
|
|
|
$tmp=~ s/((WP|Wikipedia):)(.*?)\|//gi;
|
|
|
$tmp=~ s/(WP: ?(.*?))/$2/g;
|
|
|
|
|
|
|
|
|
return $tmp;
|
|
|
}
|
|
|
|
|
|
sub norm{
|
|
|
my $tmp = shift;
|
|
|
if ($tmp =~/^ja/){
|
|
|
return "01";
|
|
|
}
|
|
|
elsif ($tmp =~/^f/){
|
|
|
return "02";
|
|
|
}
|
|
|
elsif ($tmp =~/^mar/){
|
|
|
return "03";
|
|
|
}
|
|
|
elsif ($tmp =~/^a[pv]/){
|
|
|
return "04";
|
|
|
}
|
|
|
elsif ($tmp =~/^ma/){
|
|
|
return "05";
|
|
|
}
|
|
|
elsif ($tmp =~/^(juin|jun)/){
|
|
|
return "06";
|
|
|
}
|
|
|
elsif ($tmp =~/^(jui|jul)/){
|
|
|
return "07";
|
|
|
}
|
|
|
elsif ($tmp =~/^(ao|ag|au)/){
|
|
|
return "08";
|
|
|
}
|
|
|
elsif ($tmp =~/^se[tp]/){
|
|
|
return "09";
|
|
|
}
|
|
|
elsif ($tmp =~/^o[kc]/){
|
|
|
return "10";
|
|
|
}
|
|
|
elsif ($tmp =~ /^nov/){
|
|
|
return "11";
|
|
|
}
|
|
|
elsif ($tmp =~/^d/){
|
|
|
return "12";
|
|
|
}
|
|
|
else {
|
|
|
return "XX";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
sub ClassDeclAutre{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $tmp = shift;
|
|
|
$tmp =~ s/\{\{(NAMESPACE|BASEPAGENAME)\}?\}?//g;
|
|
|
$tmp =~ s/\&(lt|gt|quot);//g;
|
|
|
$tmp =~ s/(\/?(small|big|center|nowiki|div)|br\/?)//g;
|
|
|
$tmp =~ s/^\s*\}\}\s*|//;
|
|
|
$tmp =~ s/^=+/titreInCat : /;
|
|
|
|
|
|
|
|
|
if ($tmp =~ /^[\|\s\*\[]*\{\{ *(traduit|traduction|translat)/i or $tmp =~ /^ *\{\{.*[ \-]?OTRS/){
|
|
|
return "trad\t$tmp";
|
|
|
$trad = 1;
|
|
|
}
|
|
|
elsif ($tmp =~ /^[\|\s\*\[\{]+(todo|. faire|atelier (de relecture|d\'.criture)|en travaux|instructions P.V|relecture|article relu|.v.nement en cours|formation)/i){
|
|
|
return "articleChantier\t$tmp";
|
|
|
$articleChantier = 1;
|
|
|
}
|
|
|
elsif ($tmp =~ /^[\|\s\*\[\{]+(.bauche|ancien AdQ|article (rejet.|d.chu|promu) en (AdQ|BA)|intention|article mentionn. par la presse)/i or $tmp=~/^ *\{\{ ?(accueil ?lumi.re|article mis en lumi.re|\| ?lumi.re)/i){
|
|
|
return "articleAssessment\t$tmp";
|
|
|
$articleAssessment = 1;
|
|
|
}
|
|
|
elsif ($tmp =~ /^[\|\s\*\[\{]+([aA]rchive LANN|U\-R3R|(m\|)?[iI]nstructions AsS|[hH]istorique d.truit|[Aa]vertissement ([Hh]omonymie|ISBN)|. illustrer|[bB]lanchiment de courtoisie|confusion|admissibilit|. sourcer|blog animal|protection|m|aidez\-moi|article sensible)/){
|
|
|
|
|
|
|
|
|
|
|
|
return "problem\t$tmp";
|
|
|
$problem = 1;
|
|
|
|
|
|
}
|
|
|
elsif ($tmp =~ /^[\|\s\*\[\{]+(archive|discussion archiv.e|discussion:.*?\/archive|archivage par)/i){
|
|
|
return "archive\t$tmp";
|
|
|
$arch = 1;
|
|
|
}
|
|
|
elsif ($tmp =~ /^[\|\s\*\[\{]+(instructions? P.S|page conserv.e|article conserv.|cette page a .t. anciennement|\{\{user:[^\/]+\/(cons|sup)|suppression|conservation)/i or ($tmp =~ /^ *\{\{ *\'*Trait.\'* (par|\:)/i && $tmp =~ /conserv|supprim/)){
|
|
|
return "keepOrsuppr\t$tmp";
|
|
|
$keepOrsuppr = 1;
|
|
|
}
|
|
|
elsif ($tmp =~ /^[\|\s\*\[\{]+(instructions? P\.?C\.?P|copie par un|du ?Bistro|contenu report. dans)/i){
|
|
|
return "copy\t$tmp";
|
|
|
$copy = 1;
|
|
|
}
|
|
|
elsif ($tmp =~ /^[\|\s\*\[\{]+(avertissement|(discussion )?(hors[ \-]sujet|h[ \-]s))/i or $tmp =~ /^ *\{\{ *(pub|promo|rappel crit.res)/i){
|
|
|
return "WPisNot\t$tmp";
|
|
|
$WPisNot = 1;
|
|
|
}
|
|
|
|
|
|
elsif ($tmp =~ /^[\|\s\*\[\{]+/){
|
|
|
if ($tmp =~ /\bprojet\b/i){
|
|
|
return "projet\t$tmp";
|
|
|
$projet = 1;
|
|
|
}
|
|
|
elsif ($tmp !~ /(sommaire|en\-t.ete de page)/){
|
|
|
return "front\t$tmp";
|
|
|
}
|
|
|
else {
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
return "post\t$tmp";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|