# Path: corpkit/constants.py
# STRINGTYPE = str if PYTHON_VERSION == 3 else basestring
# 
# PYTHON_VERSION = sys.version_info.major


from corpkit.constants import STRINGTYPE, PYTHON_VERSION
    from pandas import DataFrame, Series
    from collections import Counter
    from corpkit.interrogation import Interrogation
        from corpkit.other import load
        import math
        
        if word_in_ref == 0:
            logaE1 = 0
        else:
            logaE1 = math.log(word_in_ref/E1)
        if word_in_target == 0:
            logaE2 = 0
        else:
            logaE2 = math.log(word_in_target/E2)
        score = float(2* ((word_in_ref*logaE1)+(word_in_target*logaE2)))
        if neg:
            score = -score
        return score

    def perc_diff_measure(word_in_ref, word_in_target, ref_sum, target_sum):
        """calculate using perc diff measure"""

        norm_target = float(word_in_target) / target_sum
        norm_ref = float(word_in_ref) / ref_sum
        # Gabrielatos and Marchi (2012) do it this way!
        if norm_ref == 0:
            norm_ref = 0.00000000000000000000000001
        return ((norm_target - norm_ref) * 100.0) / norm_ref

    def set_threshold(threshold):
        """define a threshold"""
        if threshold is False:
            return 0
        if threshold is True:
            threshold = 'm'

# Path: corpkit/constants.py
# STRINGTYPE = str if PYTHON_VERSION == 3 else basestring
# 
# PYTHON_VERSION = sys.version_info.major


# Path: corpkit/keys.py
from corpkit.constants import STRINGTYPE, PYTHON_VERSION
    from pandas import DataFrame, Series
    from collections import Counter
    from corpkit.interrogation import Interrogation
        from corpkit.other import load
        import math

        
        if word_in_ref == 0:
            logaE1 = 0
        else:
            logaE1 = math.log(word_in_ref/E1)
        if word_in_target == 0:
            logaE2 = 0
        else:
            logaE2 = math.log(word_in_target/E2)
        score = float(2* ((word_in_ref*logaE1)+(word_in_target*logaE2)))
        if neg:
            score = -score
        return score

    def perc_diff_measure(word_in_ref, word_in_target, ref_sum, target_sum):
        """calculate using perc diff measure"""

        norm_target = float(word_in_target) / target_sum
        norm_ref = float(word_in_ref) / ref_sum
        # Gabrielatos and Marchi (2012) do it this way!
        if norm_ref == 0:
            norm_ref = 0.00000000000000000000000001
        return ((norm_target - norm_ref) * 100.0) / norm_ref

    def set_threshold(threshold):
        """define a threshold"""
        if threshold is False:
            return 0
        if threshold is True:
            threshold = 'm'

        if isinstance(threshold, STRINGTYPE):