Browse Source

Stats file added

Loweel 4 years ago
parent
commit
b459063614
1 changed files with 6 additions and 0 deletions
  1. 6 0
      file.go

+ 6 - 0
file.go

@@ -56,6 +56,11 @@ func saveBayesToFile() {
 		tmpJSON = jerr.Error()
 	}
 
+	sJSON, serr := json.MarshalIndent(Classifier.STATS, "", " ")
+	if serr != nil {
+		sJSON = serr.Error()
+	}
+
 	dumpfile := os.Getenv("DUMPFILE")
 	if dumpfile == "" {
 		dumpfile = "bayes.json"
@@ -65,6 +70,7 @@ func saveBayesToFile() {
 		log.Println(tmpJSON)
 	} else {
 		writeToFile(dumpfile, tmpJSON)
+		writeToFile(dumpfile+".stats", sJSON)
 		log.Println("File saved: ", dumpfile)
 	}