<commit_before># <NAME> <<EMAIL>>

##____________________________________________________________________________||
from CountsBase import CountsBase

##____________________________________________________________________________||
class Counts(CountsBase):
    def __init__(self):
        self._counts = { }

    def count(self, key, w = 1, nvar = None):
        if nvar is None: nvar = w**2
        self.addKey(key)
        self._counts[key]['n'] += w
        self._counts[key]['nvar'] += nvar

    def addKey(self, key):
        if key not in self._counts: self._counts[key] = {'n': 0.0, 'nvar': 0.0 }

    def addKeys(self, keys):<commit_msg>use OrderedDict in Counts<commit_after># <NAME> <<EMAIL>>

##____________________________________________________________________________||
import collections
from CountsBase import CountsBase

##____________________________________________________________________________||
class Counts(CountsBase):
    def __init__(self):
        self._counts = { }

    def count(self, key, w = 1, nvar = None):
        if nvar is None: nvar = w**2
        self.addKey(key)
        self._counts[key]['n'] += w
        self._counts[key]['nvar'] += nvar

    def addKey(self, key):
        if key not in self._counts:
            self._counts[key] = collections.OrderedDict((('n', 0.0), ('nvar', 0.0)))

    def addKeys(self, keys):
{'fraction_non_alphanumeric': 0.13132795304475423, 'fraction_numerical': 0.00880410858400587, 'mean_word_length': 3.769230769230769, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '941089', 'n_tokens_mistral': 398, 'n_tokens_neox': 378, 'n_words': 96}