pointwise_mi¶
- corpustools.mutualinfo.mutual_information.pointwise_mi(corpus_context, query, env_filtered=False, word_boundary='Word-end only', in_word=False, stop_check=None, call_back=None)[source]¶
Calculate the mutual information for a bigram.
- Parameters
- corpus_contextCorpusContext
Context manager for a corpus
- querytuple
Tuple of two strings, each a segment/letter
- env_filteredbool
True if a env filter selected by the user. Defaults to False
- word_boundarystr or bool
How to count word boundaries once per word. str if no env filter selected, bool with env filters ‘Word-end only’ counts once, ‘Both sides’ counts twice (word-initial and word-final), and ‘Ignored’ does not count word boundaries. Trueː env filter selected and # can be a part of a bigram. Defaults to ‘Word-end only’ (count word boundary once in word-final position)
- in_wordbool
Flag to calculate non-local, non-ordered mutual information, defaults to False
- stop_checkcallable or None
Optional function to check whether to gracefully terminate early
- call_backcallable or None
Optional function to supply progress information during the function
- Returns
- float
Mutual information of the bigram