// countNgrams maps matched tokens to the number of ngrams, shared with input string
355991
func (ngram *NGramIndex) countNgrams(inputNgrams []uint32) map[TokenID]int {
	counters := make(map[TokenID]int)
	for _, ngramHash := range inputNgrams {
		ngram.RLock()
		for tok := range ngram.index[ngramHash] {
			counters[tok]++
		}
		ngram.RUnlock()
	}
	return counters
}
168194
func (m *Manager) CountSMSHistorySince(phonenumber string, since time.Time) (int, error) {
	return m.collection.Find(bson.M{"createdat": bson.M{"$gte": since}}).Count()
}
498956
func tagsToMapRAM(ts []*ram.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredRAM(t) {
			result[aws.StringValue(t.Key)] = aws.StringValue(t.Value)
		}
	}

	return result
}
1306180
func (re *Regexp) GetGroupNumbers() []int {
	var result []int

	if re.caps == nil {
		result = make([]int, re.capsize)

		for i := 0; i < len(result); i++ {
			result[i] = i
		}
	} else {
		result = make([]int, len(re.caps))

		for k, v := range re.caps {
			result[v] = k
		}
	}

	return result
}
1138335
func (g *Generator) Words(count int) []string {
	words := make([]string, count)
	for i := 0; i < count; i++ {
		words[i] = g.Word()
	}
	return words
}
278359
func (s *sender) Count(stat string, count float64, tags ...string) {
	s.Called(stat, count, tags)
}
273454
func (b *bmBlock) count(start, end uintptr) (count int) {
	br := b[start/uintptrBits : end/uintptrBits+1]
	for i, w := range br {
		if i == 0 {
			w &= blockmask(start)
		}
		if i == len(br)-1 {
			w &^= blockmask(end)
		}
		count += onesCountPtr(w)
	}
	return count
}
209034
func (m *metadataTracker) Counts(dev protocol.DeviceID, flag uint32) Counts {
	if bits.OnesCount32(flag) > 1 {
		panic("incorrect usage: set at most one bit in flag")
	}

	m.mut.RLock()
	defer m.mut.RUnlock()

	idx, ok := m.indexes[metaKey{dev, flag}]
	if !ok {
		return Counts{}
	}

	return m.counts.Counts[idx]
}
500510
func (c *Client) CountMachines() (int, error) {
	var resp int
	req := request{
		method: client.HEAD,
		url:    apiMachines,
		resp:   &resp,
	}
	if _, err := c.sendRequest(req); err != nil {
		return -1, errors.Newf(err, "failed to get count of machines")
	}
	return resp, nil
}
762450
func (x *Intention) countExact(ns, n string) int {
	// If NS is wildcard, it must be zero since wildcards only follow exact
	if ns == IntentionWildcard {
		return 0
	}

	// Same reasoning as above, a wildcard can only follow an exact value
	// and an exact value cannot follow a wildcard, so if name is a wildcard
	// we must have exactly one.
	if n == IntentionWildcard {
		return 1
	}

	return 2
}
646735
func tagsFromMapRAM(m map[string]interface{}) []*ram.Tag {
	result := make([]*ram.Tag, 0, len(m))
	for k, v := range m {
		t := &ram.Tag{
			Key:   aws.String(k),
			Value: aws.String(v.(string)),
		}
		if !tagIgnoredRAM(t) {
			result = append(result, t)
		}
	}

	return result
}
589578
func (c *statsClient) Count(name string, value int64, rate float64) {
	if err := c.client.Count(prefix+name, value, c.tags, rate); err != nil {
		c.logger.Printf("statsd.StatsClient.Count error: %s", err)
	}
}
1178458
func (idx *MemoryIndex) Count() (int64, error) {
	return int64(idx.Fanout[fanout-1]), nil
}
904288
func countAnyByte(s string, t string) int {
	n := 0
	for i := 0; i < len(s); i++ {
		if byteIndex(t, s[i]) >= 0 {
			n++
		}
	}
	return n
}
137602
func (m *AgentPool) Counts() map[string]int {
	out := make(map[string]int)

	for key, agents := range m.agents {
		out[key.tunnelID] += len(agents)
	}

	return out
}
475069
func (xs *xstats) Count(stat string, count float64, tags ...string) {
	if xs.s == nil {
		return
	}
	tags = append(tags, xs.tags...)
	xs.s.Count(xs.prefix+stat, count, tags...)
}
241360
func (s *Sublist) Count() uint32 {
	s.RLock()
	defer s.RUnlock()
	return s.count
}