calc_prod_all_envs

corpustools.prod.pred_of_dist.calc_prod_all_envs(corpus_context, seg1, seg2, all_info=False, stop_check=None, call_back=None)[source]

Main function for calculating predictability of distribution for two segments over a corpus, regardless of environment.

Parameters:

corpus_context : CorpusContext

Context manager for a corpus

seg1 : str

The first segment

seg2 : str

The second segment

all_info : bool

If true, all the intermediate numbers for calculating predictability of distribution will be returned. If false, only the final entropy will be returned. Defaults to False.

stop_check : callable, optional

Optional function to check whether to gracefully terminate early

call_back : callable, optional

Optional function to supply progress information during the function

Returns:

float or list

A list of [entropy, frequency of environment, frequency of seg1, frequency of seg2] if all_info is True, or just entropy if all_info is False.