Beispiel #1
0
func Learn(msg telegram.TObject) bool {
	if msg["text"] != nil {
		if strings.Contains(msg["text"].(string), "#RICH") {
			eng.Learn(common.TextToSample(msg["text"].(string)), []float64{1, 0}, 0.1)
			return true
		} else if strings.Contains(msg["text"].(string), "#POOR") {
			eng.Learn(common.TextToSample(msg["text"].(string)), []float64{0, 1}, 0.1)
			return true
		}
	}

	return false
}
Beispiel #2
0
func Gun(tg *telegram.Telegram, msg telegram.TObject) bool {
	if msg["text"] != nil {
		out := eng.Calculate(common.TextToSample(msg["text"].(string)))
		log.Println(out)

		if (out[0] > 0.5) && (out[0]-out[1] > 0.3) {
			tg.ReplyToMessage(msg.MessageId(), "#RICH", msg.ChatId())
			return true
		}
	}

	return false
}