1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
| SListe *GenererNseq (int seuil, SListe ** s,SListe ** seq)
{
SListe *p1, *p2, *ss;
Coordonnees *c1, *c2, *c = NULL;
int id1, id2, supp1 = 0;
mots *m, *mt;
ss = *seq;
SListe *t;
printf("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
p1=malloc (sizeof (SListe));
if ( p1 == NULL )
{
fprintf(stderr,"Allocation Impossible p1");
exit(EXIT_FAILURE);
}
p2=malloc (sizeof (SListe));
if ( p2 == NULL )
{
fprintf(stderr,"Allocation Impossible p2");
exit(EXIT_FAILURE);
}
ss= malloc (sizeof (SListe));
if ( ss == NULL )
{
fprintf(stderr,"Allocation Impossible ss");
exit(EXIT_FAILURE);
}
t= malloc (sizeof (Coordonnees));
//if ( t == NULL )
//{
// fprintf(stderr,"Allocation Impossible tt");
// exit(EXIT_FAILURE);
//}
c1= malloc (sizeof (Coordonnees));
if ( c1 == NULL )
{
fprintf(stderr,"Allocation Impossible c1");
exit(EXIT_FAILURE);
}
c2= malloc (sizeof (Coordonnees));
if ( c2 == NULL )
{
fprintf(stderr,"Allocation Impossible c2");
exit(EXIT_FAILURE);
}
c=malloc (sizeof (SListe));
if ( c == NULL )
{
fprintf(stderr,"Allocation Impossible c");
exit(EXIT_FAILURE);
}
m=malloc (sizeof (mots));
if ( m == NULL )
{
fprintf(stderr,"Allocation Impossible m");
exit(EXIT_FAILURE);
}
mt=malloc(sizeof(mots));
if ( mt == NULL )
{
fprintf(stderr,"Allocation Impossible mt");
exit(EXIT_FAILURE);
}
for (p1 = *s; p1 != NULL; p1 = p1->suivant)
{
/* printf("boucle1"); */
id1 = dernierMot (p1);
for (p2 = *seq; p2 != NULL; p2 = p2->suivant)
{
/* printf("boucle2"); */
supp1 = 0;
c = NULL;
m = p2->m;
id2 = m->ID;
if (id1 == id2)
{
for (c1 = p1->c; c1 != NULL; c1 = c1->suivant)
for (c2 = p2->c; c2 != NULL; c2 = c2->suivant)
{
if (c1->nl == c2->nl)
/* si 2 mots differents trouvés */
{
c = InsertionEnTeteCoordonnee (c, c2->nl, c2->pos);
supp1++;
}
/* fin calcul supp */
}
if (supp1 >= seuil)
{
mt = NULL;
for (m = p1->m; m->suivant != NULL; m = m->suivant)
mt = InsertionEnTeteMot (mt, m->ID, m->successif);
for (m = p2->m; m->suivant != NULL; m = m->suivant)
mt = InsertionEnTeteMot (mt, m->ID, m->successif);
t = InsertionEnTeteS (t, dernierMot (p2), 0);
for (m = mt; m != NULL; m = m->suivant)
t->m = InsertionEnTeteMot (t->m, m->ID, m->successif);
t->c = c;
t->freq = supp1;
}
}
}
}
free(p1);
p1=NULL;
free(p2);
p2=NULL;
free(ss);
ss=NULL;
free(c1);
c1=NULL;
free(c2);
c2=NULL;
free(c);
c=NULL;
// Verifier (t);
//free(t);
// t=NULL;
return t;
} |
Partager