示例#1
0
文件: rich.go 项目: PeterCxy/gotgbot
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
}
示例#2
0
文件: rich.go 项目: PeterCxy/gotgbot
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
}