pointwise_mi

corpustools.mutualinfo.mutual_information.pointwise_mi(corpus_context, query, halve_edges=False, in_word=False, stop_check=None, call_back=None)[source]

Calculate the mutual information for a bigram.

Parameters:

corpus_context : CorpusContext

Context manager for a corpus

query : tuple

Tuple of two strings, each a segment/letter

halve_edges : bool

Flag whether to only count word boundaries once per word rather than twice, defaults to False

in_word : bool

Flag to calculate non-local, non-ordered mutual information, defaults to False

stop_check : callable or None

Optional function to check whether to gracefully terminate early

call_back : callable or None

Optional function to supply progress information during the function

Returns:

float

Mutual information of the bigram