KullbackLeibler¶
-
corpustools.kl.kl.
KullbackLeibler
(corpus_context, seg1, seg2, side, outfile=None, stop_check=False, call_back=False)[source]¶ Calculates KL distances between two Phoneme objects in some context, either the left or right-hand side. Segments with identical distributions (ie. seg1==seg2) have a KL of zero. Segments with similar distributions therefore have low numbers, so high numbers indicate possible allophones.
Parameters: - corpus_context : CorpusContext
Context manager for a corpus
- seg1 : str
First segment
- seg2 : str
Second segment
- side : str
One of ‘right’, ‘left’ or ‘both’
- outfile : str
Full path to save output
- 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