plotcounts module

Plot word counts.

plotcounts.get_power_law_params(word_counts)

Get the power law parameters.

Moreno-Sanchez et al (2016) define alpha (Eq. 1),

beta (Eq. 2) and the maximum likelihood estimation (mle) of beta (Eq. 6).

Moreno-Sanchez I, Font-Clos F, Corral A (2016)

Large-Scale Analysis of Zipf’s Law in English Texts. PLoS ONE 11(1): e0147073. https://doi.org/10.1371/journal.pone.0147073

plotcounts.main()

Run the command line program.

plotcounts.nlog_likelihood(beta, counts)

Log-likelihood function.

plotcounts.parse_command_line()

Parse the command line for input arguments.

plotcounts.plot_fit(curve_xmin, curve_xmax, max_rank, alpha, ax)

Plot the power law curve that was fitted to the data.

curve_xminfloat

Minimum x-bound for fitted curve

curve_xmaxfloat

Maximum x-bound for fitted curve

max_rankint

Maximum word frequency rank.

alphafloat

Estimated alpha parameter for the power law.

axmatplotlib axes

Scatter plot to which the power curve will be added.

plotcounts.save_configuration(fname, params)

Save configuration to a file.

plotcounts.set_plot_params(param_file)

Set the matplotlib parameters.