Home  Trees  Indices  Help 



object +  dict +  FreqDist
A frequency distribution for the outcomes of an experiment. A frequency distribution records the number of times each outcome of an experiment has occurred. For example, a frequency distribution could be used to record the frequency of each word type in a document. Formally, a frequency distribution can be defined as a function mapping from each sample to the number of times that sample occurred as an outcome.
Frequency distributions are generally constructed by running a number of experiments, and incrementing the count for a sample every time it is an outcome of an experiment. For example, the following code will produce a frequency distribution that encodes how often each word occurs in a text:
>>> fdist = FreqDist() >>> for word in tokenize.whitespace(sent): ... fdist.inc(word.lower())
An equivalent way to do this is with the initializer:
>>> fdist = FreqDist(word.lower() for word in tokenize.whitespace(sent))


new empty dictionary 


None 


None 


int



int



list



list



int





int



list of float



float 


any or None













list of any



list of any



list of tuple



iter



iter



iter



iter of any



FreqDist



None 


v, remove specified key and return the corresponding value 


(k, v), remove and return some (key, value) pair as a 


None 


















string 


string 




Inherited from 

Construct a new frequency distribution. If In particular,

Increment this

Set this






Return the count of a given sample. The count of a sample is defined
as the number of times that sample outcome was recorded by this

Return the cumulative frequencies of the specified samples. If no samples are specified, all counts are returned, starting with the largest.

Return the frequency of a given sample. The frequency of a sample is
defined as the count of that sample divided by the total number of sample
outcomes that have been recorded by this

Return the sample with the greatest number of outcomes in this
frequency distribution. If two or more samples have the same number of
outcomes, return one of them; which sample is returned is undefined. If
no outcomes have occurred in this frequency distribution, return

Plot samples from the frequency distribution displaying the most frequent sample first. If an integer parameter is supplied, stop after this many samples have been plotted. If two integer parameters m, n are supplied, plot a subset of the samples, beginning with m and stopping at n1. For a cumulative plot, specify cumulative=True. (Requires Matplotlib to be installed.)

Tabulate the given samples from the frequency distribution (cumulative), displaying the most frequent sample first. If an integer parameter is supplied, stop after this many samples have been plotted. If two integer parameters m, n are supplied, plot a subset of the samples, beginning with m and stopping at n1. (Requires Matplotlib to be installed.)

Return the samples sorted in decreasing order of frequency.

Return the samples sorted in decreasing order of frequency.

Return the items sorted in decreasing order of frequency.

Return the samples sorted in decreasing order of frequency.

Return the samples sorted in decreasing order of frequency.

Return the values sorted in decreasing order.

Return the items sorted in decreasing order of frequency.

Create a copy of this frequency distribution.

Update the frequency distribution with the provided list of samples. This is a faster way to add multiple samples to the distribution.

If key is not found, d is returned if given, otherwise KeyError is raised

2tuple; but raise KeyError if D is empty

Remove all items from D.

x==y

x!=y

x<=y

x<y

x>=y

x>y

repr(x)


x[y]

Home  Trees  Indices  Help 


Generated by Epydoc 3.0.1 on Mon Apr 11 14:39:49 2011  http://epydoc.sourceforge.net 