[LON-CAPA-cvs] cvs: modules /gerd classify.pl

www lon-capa-cvs@mail.lon-capa.org
Fri, 24 Mar 2006 21:44:54 -0000


www		Fri Mar 24 16:44:54 2006 EDT

  Modified files:              
    /modules/gerd	classify.pl 
  Log:
  Asks again if classification is wrong
  
  
Index: modules/gerd/classify.pl
diff -u modules/gerd/classify.pl:1.1 modules/gerd/classify.pl:1.2
--- modules/gerd/classify.pl:1.1	Tue Mar 21 17:00:51 2006
+++ modules/gerd/classify.pl	Fri Mar 24 16:44:54 2006
@@ -12,23 +12,32 @@
       $sender=$hash{$version.':'.$url.':sendername'};
       $domain=$hash{$version.':'.$url.':senderdomain'};
       $message=$hash{$version.':'.$url.':message'};
-      print &unescape($message)."\n>";
-      $input=<STDIN>;
-      chomp($input);
-      if ($input eq 'q') {
-         untie(%hash);
-         untie(%already);
-         close(OUT);
-         $time=time;
-         copy('classified.db','classified.'.$time.'.db');
-         copy('classified.csv','classified.'.$time.'.csv');
-         exit;
-      }
-      if ($input=~/^(\d[a-d])+$/) {
-         print OUT "$sender,$domain,$url,$input\n";
-         $already{$key}=1;  
-      }
-   }
+      print &unescape($message)."\n---\n";
+      print (<<ENDCLASS);
+1 emot pos; 2 emot neg; 3 surf Q; 4 surf A; 5 proc Q; 6 proc A; 7 proc Q; 8 proc A
+a unrel; b sol; c math; d phys
+ENDCLASS
+      $input='';
+      while (1) {
+	 print ">";
+	 $input=<STDIN>;
+	 chomp($input);
+	 if ($input eq 'q') {
+	     untie(%hash);
+	     untie(%already);
+	     close(OUT);
+	     $time=time;
+	     copy('classified.db','classified.'.$time.'.db');
+	     copy('classified.csv','classified.'.$time.'.csv');
+	     exit;
+	 }
+	 if ($input=~/^(\d[a-d])+$/) {
+	     print OUT "$sender,$domain,$url,".length(&unescape($message)).",$input\n";
+	     $already{$key}=1;
+             last;
+	 }
+     }
+  }
 }
 untie(%hash);
 untie(%already);