code: def zipf_distribution(nbr_symbols, alpha):
    
    tmp = np.power(np.arange(1, nbr_symbols + 1), -alpha)
    zeta = np.r_[0.0, np.cumsum(tmp)]
    return [x / zeta[-1] for x in zeta]
docs: Helper function: Create a Zipf distribution.
  
    Args:
      nbr_symbols: number of symbols to use in the distribution.
      alpha: float, Zipf's Law Distribution parameter. Default = 1.5.
        Usually for modelling natural text distribution is in
        the range [1.1-1.6].
  
    Returns:
      distr_map: list of float, Zipf's distribution over nbr_symbols.