<commit_before>//
// policy.go
//
package srnd

import (
	"regexp"
	"strings"
)

type FeedPolicy struct {
	rules map[string]string
}

// do we allow this newsgroup?
func (self *FeedPolicy) AllowsNewsgroup(newsgroup string) (result bool) {
	var k, v string
	var allows, disallows int
	for k, v = range self.rules {
		v = strings.Trim(v, " ")
		match, err := regexp.MatchString(k, newsgroup)
		if err == nil {
			if match {
				if v == "1" {
					allows++
				} else if v == "0" {
					disallows++
				}
			}
		}
	}

	result = allows > 0 && disallows == 0

	return
}
<commit_msg>fix ?<commit_after>//
// policy.go
//
package srnd

import (
	"regexp"
	"strings"
)

type FeedPolicy struct {
	rules map[string]string
}

// do we allow this newsgroup?
func (self *FeedPolicy) AllowsNewsgroup(newsgroup string) (result bool) {
	var k, v string
	var allows, disallows int
	for k, v = range self.rules {
		v = strings.Trim(v, " ")
		match, err := regexp.MatchString(k, newsgroup)
		if err == nil {
			if match {
				if v == "1" {
					allows++
				} else if v == "0" {
					return false
				}
			}
		}
	}

	result = allows > 0

	return
}

{'fraction_non_alphanumeric': 0.13906111603188662, 'fraction_numerical': 0.006200177147918512, 'mean_word_length': 2.6334405144694535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7047471', 'n_tokens_mistral': 491, 'n_tokens_neox': 421, 'n_words': 126}