#!/usr/bin/perl # IM2GraphML.pl < Exemple : IM2GraphML.pl PHILOLynx-dump-normaliseCordialLemmeCatBreve.ArticleEgalFenetre.CoocMaxDistance20MinCooc5.IM 8 9.0 > PHILOLynx-dump-normaliseCordialLemmeCatBreve.ArticleEgalFenetre.CoocMaxDistance20MinCooc5.IM.DMMAx8IMMin9.0.gml Puis : xsltproc GraphML2Pajek.xsl PHILOLynx-dump-normaliseCordialLemmeCatBreve.ArticleEgalFenetre.CoocMaxDistance20MinCooc5.IM.DMMAx8IMMin9.0.gml |AjouteCR > PHILOCordialDMMax8IMMin9.net Format de sortie : GraphML José_Np Gil_Np 14.42 jacques_Nc A faire : Bugs et problèmes : DOC $ChaineUsage = "Usage : IM2GraphML.pl \n" ; if (@ARGV != 3) {die $ChaineUsage ; } $FichierEntree = $ARGV[0] ; $DistancePlafond = $ARGV[1] ; $IMPlancher = $ARGV[2] ; $Trace = 0 ; $PourWindows = 0 ; if ($PourWindows == 0) { $FinLigne = "\n" ; } else { $FinLigne = "\r\n" ; } %Cooccurrent2Numero = () ; $NumeroCooccurrent = 1 ; imprimeEnTeteGraphML() ; open(ENTREE, $FichierEntree) ; # while ($Ligne = ){ if ($Ligne =~ /.+ c1=\"(.+)\" c2=\"(.+)\" +fc1.+ dm=\"([0-9.]+)\" im=\"([0-9.]+).+/) { $Cooc1 = $1 ; $Cooc2 = $2 ; $DistanceMoyenne = $3 ; $IM = $4 ; if ($Trace == 1) {print "$Ligne\t$Cooc1\t$Cooc2\t$DistanceMoyenne\t$IM$FinLigne" ; } if ($DistanceMoyenne <= $DistancePlafond && $IM >= $IMPlancher) { if ($Trace == 1) {print "===$FinLigne" ; } #print "$Ligne" ; if (exists $Cooccurrent2Numero{$Cooc1}) { $NumeroCooc1 = $Cooccurrent2Numero{$Cooc1} ; } else { $Cooccurrent2Numero{$Cooc1} = $NumeroCooccurrent ; print " $Cooc1$FinLigne" ; $NumeroCooccurrent++ ; } if (exists $Cooccurrent2Numero{$Cooc2}) { $NumeroCooc1 = $Cooccurrent2Numero{$Cooc2} ; } else { $Cooccurrent2Numero{$Cooc2} = $NumeroCooccurrent ; print " $Cooc2$FinLigne" ; $NumeroCooccurrent++ ; } print " $IM$FinLigne" ; } } } close(ENTREE) ; imprimeEnPiedGraphML() ; sub imprimeEnTeteGraphML{ print "$FinLigne$FinLigne $FinLigne $FinLigne $FinLigne" ; } sub imprimeEnPiedGraphML{ print " $FinLigne$FinLigne" ; }