def __init__(self, _dict=None, **kwargs): if _dict is None: self.__init__(kwargs) else: if not all(isinstance(x, Rational) for x in _dict.values()): raise TypeError("powers of dimensions must be rational") Counter.__init__(self, _dict) self.clean()
def __init__(self, n, *args, **kwargs): assert n>=1 self._size = n self._worst = None Counter.__init__(self, *args, **kwargs) if len(self)>=n: self._worst = self.most_common(n)[-1] for k,v in self.most_common()[n:]: del self[k]
def __init__(self, n, *args, **kwargs): assert n >= 1 self._size = n self._worst = None Counter.__init__(self, *args, **kwargs) if len(self) >= n: self._worst = self.most_common(n)[-1] for k, v in self.most_common()[n:]: del self[k]
def __init__(self, max_len, N_max=5): ''' @summary: NGramSet Constructor @param max_len: 最优序列长度 @param N_max: CCS2012 对应最大n-gram ''' Counter.__init__(self) self.N_max = N_max self.max_len = max_len self.alphabet_size = 0 # 记录项总数 self.all_record_num = 0 # 记录数据集中记录总数 self.TERM = 0 # 序列结束符
def __init__(self, max_len, N_max = 5): ''' @summary: NGramSet Constructor @param max_len: 最优序列长度 @param N_max: CCS2012 对应最大n-gram ''' Counter.__init__(self) self.N_max = N_max self.max_len = max_len self.alphabet_size = 0 # 记录项总数 self.all_record_num = 0 # 记录数据集中记录总数 self.TERM = 0 # 序列结束符
def __init__(self, samples=None): """ Construct a new frequency distribution. If ``samples`` is given, then the frequency distribution will be initialized with the count of each object in ``samples``; otherwise, it will be initialized to be empty. In particular, ``FreqDist()`` returns an empty frequency distribution; and ``FreqDist(samples)`` first creates an empty frequency distribution, and then calls ``update`` with the list ``samples``. :param samples: The samples to initialize the frequency distribution with. :type samples: Sequence """ Counter.__init__(self, samples) # Cached number of samples in this FreqDist self._N = None
def __init__(self, unknown_cutoff, *counter_args): Counter.__init__(self, *counter_args) self.cutoff = unknown_cutoff
def __init__(self, *args, **kw): Counter.__init__(self, *args, **kw) self.__changed = set()
def __init__(self, *args, **kwargs): defaultdict.__init__(self, int) Counter.__init__(self, *args, **kwargs) for k, v in list(self.items()): if not v: del self[k]
def __init__(self, *args, **kwargs): AttrDict.__init__(self, *args, **kwargs) Counter.__init__(self) self.__exclude_keys__ |= {'most_common'}
def __init__(self, *args, **kwargs): """ A dictionary with sorted float values (by default, 0.0). """ Counter.__init__(self, dict(*args, **kwargs))
def __init__(self, word_list = []): self.word_list = word_list Counter.__init__(self, word_list)
def __init__(self, unknown_cutoff, *counter_args): if isinstance(unknown_cutoff, dict): Counter.__init__(self, unknown_cutoff, *counter_args) else: Counter.__init__(self, *counter_args) self.cutoff = unknown_cutoff
def __init__(self, iterable): self.__finishedinit = False Counter.__init__(self, iterable) self.__finishedinit = True
def __init__(self, *args, **kwargs): Counter.__init__(self, *args, **kwargs)
def __init__(self, dic): self._len = -1 Counter.__init__(self, dic)
def __init__(self, factors={}): Counter.__init__(self, factors)
def __init__(self, word): Counter.__init__(self, word) self.word = word
def __init__(self, samples=None): Counter.__init__(self, samples)
def __init__(self, sampleData=None): #Has sampleData being the Counter.__init__(self, sampleData) # Uses Counter class's instantiation
def __init__(self, word_list=[]): self.word_list = word_list Counter.__init__(self, word_list)