Exemple #1
0
func Classify(classifier *bayesian.Classifier, name string) (string, float64) {
	name = strings.ToLower(name)
	scores, likely, _ := classifier.ProbScores([]string{name})
	gender := GenderFromInt(likely)
	probability := scores[likely]
	if probability == 0.5936993620304059 {
		gender = None
		probability = 0
	}
	return string(gender), probability
}
Exemple #2
0
func Learn(classifier *bayesian.Classifier, name string, gender string) {
	strings.ToLower(name)
	classifier.Learn([]string{name}, Gender(gender))
}