Browse Source

Stats file added

Loweel 4 years ago
parent
commit
a7d0ac576c
1 changed files with 5 additions and 5 deletions
  1. 5 5
      file.go

+ 5 - 5
file.go

@@ -56,10 +56,10 @@ func saveBayesToFile() {
 		tmpJSON = jerr.Error()
 	}
 
-	sJSON, serr := json.MarshalIndent(Classifier.STATS, "", " ")
-	if serr != nil {
-		sJSON = []byte(serr.Error())
-	}
+	Classifier.STATS.Range(func(key interface{}, value interface{}) bool {
+		fmt.Printf("%s : %d", key.(string), value.(int64))
+		return true
+	})
 
 	dumpfile := os.Getenv("DUMPFILE")
 	if dumpfile == "" {
@@ -70,7 +70,7 @@ func saveBayesToFile() {
 		log.Println(tmpJSON)
 	} else {
 		writeToFile(dumpfile, tmpJSON)
-		writeToFile(dumpfile+".stats", string(sJSON))
+
 		log.Println("File saved: ", dumpfile)
 	}