calc_prod

corpustools.prod.pred_of_dist.calc_prod(corpus_context, envs, strict=True, all_info=False, ordered_pair=None, stop_check=None, call_back=None)[source]

Main function for calculating predictability of distribution for two segments over specified environments in a corpus.

Parameters
corpus_contextCorpusContext

Context manager for a corpus

envslist of EnvironmentFilter

List of EnvironmentFilter objects that specify environments

strictbool

If true, exceptions will be raised for non-exhausive environments and non-unique environments. If false, only warnings will be shown. Defaults to True.

all_infobool

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_checkcallable, optional

Optional function to check whether to gracefully terminate early

call_backcallable, optional

Optional function to supply progress information during the function

Returns
dict

Keys are the environments specified and values are either 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.