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_context : CorpusContext
Context manager for a corpus
- query : tuple
Tuple of two strings, each a segment/letter
- env_filtered : bool
True if a env filter selected by the user. Defaults to False
- word_boundary : str 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_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