<commit_before>// +build all,multi multi

package main // import "cirello.io/gochatbot"

import (
	"fmt"
	"log"
	"os"
	"strings"
	"sync"

	"cirello.io/gochatbot/bot"
	"cirello.io/gochatbot/brain"
	"cirello.io/gochatbot/providers"
	"cirello.io/gochatbot/rules/cron"
	"cirello.io/gochatbot/rules/ops"
	"cirello.io/gochatbot/rules/reddit"
	"cirello.io/gochatbot/rules/regex"
	"cirello.io/gochatbot/rules/rpc"
)

func main() {

	var wg sync.WaitGroup
	var botCount int

	for {
		e := &envGet{botCount}
		if e.getenv("GOCHATBOT_NAME") == "" {
			break
		}
		wg.Add(1)
		go func(e *envGet) {
			name := e.getenv("GOCHATBOT_NAME")
			if name == "" {
				name = "gochatbot"
			}

			provider := providers.Detect(e.getenv)
			if err := provider.Error(); err != nil {
				log.SetOutput(os.Stderr)
				log.Fatalln("error in message provider:", err)
			}

			memory := brain.Detect(e.getenv)
			if err := memory.Error(); err != nil {
				log.SetOutput(os.Stderr)
				log.Fatalln("error in brain memory:", err)
			}

			options := []bot.Option{
				bot.MessageProvider(provider),
				bot.RegisterRuleset(regex.New(regexRules)),
				bot.RegisterRuleset(cron.New(cronRules)),
				bot.RegisterRuleset(reddit.New()),
				bot.RegisterRuleset(ops.New()),
			}

			rpcHostAddr := e.getenv("GOCHATBOT_RPC_BIND")
			if rpcHostAddr != "" {
				options = append(
					options,
					bot.RegisterRuleset(rpc.New(rpcHostAddr)),
				)<commit_msg>Fix regression in ops ruleset for multi mode<commit_after>// +build all,multi multi

package main // import "cirello.io/gochatbot"

import (
	"fmt"
	"log"
	"os"
	"strings"
	"sync"

	"cirello.io/gochatbot/bot"
	"cirello.io/gochatbot/brain"
	"cirello.io/gochatbot/providers"
	"cirello.io/gochatbot/rules/cron"
	"cirello.io/gochatbot/rules/ops"
	"cirello.io/gochatbot/rules/reddit"
	"cirello.io/gochatbot/rules/regex"
	"cirello.io/gochatbot/rules/rpc"
)

func main() {

	var wg sync.WaitGroup
	var botCount int

	for {
		e := &envGet{botCount}
		if e.getenv("GOCHATBOT_NAME") == "" {
			break
		}
		wg.Add(1)
		go func(e *envGet) {
			name := e.getenv("GOCHATBOT_NAME")
			if name == "" {
				name = "gochatbot"
			}

			provider := providers.Detect(e.getenv)
			if err := provider.Error(); err != nil {
				log.SetOutput(os.Stderr)
				log.Fatalln("error in message provider:", err)
			}

			memory := brain.Detect(e.getenv)
			if err := memory.Error(); err != nil {
				log.SetOutput(os.Stderr)
				log.Fatalln("error in brain memory:", err)
			}

			options := []bot.Option{
				bot.MessageProvider(provider),
				bot.RegisterRuleset(regex.New(regexRules)),
				bot.RegisterRuleset(cron.New(cronRules)),
				bot.RegisterRuleset(reddit.New()),
				bot.RegisterRuleset(ops.New(opsCmds)),
			}

			rpcHostAddr := e.getenv("GOCHATBOT_RPC_BIND")
			if rpcHostAddr != "" {
				options = append(
					options,
					bot.RegisterRuleset(rpc.New(rpcHostAddr)),
				)
{'fraction_non_alphanumeric': 0.16005567153792624, 'fraction_numerical': 0.0006958942240779402, 'mean_word_length': 3.423076923076923, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2531984', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1138, 'n_words': 181}