few changes
authoradash <adash>
Thu, 19 Nov 2009 19:12:07 +0000 (19:12 +0000)
committeradash <adash>
Thu, 19 Nov 2009 19:12:07 +0000 (19:12 +0000)
Robust/src/Benchmarks/Distributed/SpamFilter/emails/gen.c

index 07ed60f0a3bddebde13cd24ce51b4bba9afa2616..53c0d35557f30ddf3944b6710b9f6c950684e7b1 100644 (file)
@@ -74,6 +74,7 @@ char** readList(char* fileName,int* num)
     (*num)++;
   }
 
+  fclose(fp);
   return list;  
 }
 
@@ -91,7 +92,6 @@ void generateEmails(int num_email,char** wl,int word_num,char** ul,int url_num,c
    srand(1);
 
    for(i=0; i < num_email;i++) {
-
      sprintf(fileNameBuffer,"%s%d",fileName,i+1);
      newFile = fopen(fileNameBuffer,"w");
 
@@ -99,7 +99,7 @@ void generateEmails(int num_email,char** wl,int word_num,char** ul,int url_num,c
      // 60% of email is spam and rest is ham
      char yes[] = "yes";
      char no[] =  "no";
-     int tmprandindex = rand() % num_email;
+     int tmprandindex = rand() % 100;
      if(tmprandindex<60)
        fprintf(newFile,"Spam: %s\n",yes);
      else 
@@ -129,7 +129,8 @@ void generateEmails(int num_email,char** wl,int word_num,char** ul,int url_num,c
      fprintf(newFile,"\n");
 
      // write Body
-     bodyLength = rand() % 500 + 300;
+     //TODO change this to make length of email small
+     bodyLength = rand() % 200 + 150;
 
      for(j=1;j<bodyLength;j++)
      {