def zipf_distribution(nbr_symbols, alpha):
    "Helper function: Create a Zipf distribution.\n\n  Args:\n    nbr_symbols: number of symbols to use in the distribution.\n    alpha: float, Zipf's Law Distribution parameter. Default = 1.5.\n      Usually for modelling natural text distribution is in\n      the range [1.1-1.6].\n\n  Returns:\n    distr_map: list of float, Zipf's distribution over nbr_symbols.\n\n  "
    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]
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.
def zipf_distribution(nbr_symbols, alpha):
    "Helper function: Create a Zipf distribution.\n\n  Args:\n    nbr_symbols: number of symbols to use in the distribution.\n    alpha: float, Zipf's Law Distribution parameter. Default = 1.5.\n      Usually for modelling natural text distribution is in\n      the range [1.1-1.6].\n\n  Returns:\n    distr_map: list of float, Zipf's distribution over nbr_symbols.\n\n  "
    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]