ieml/distance/order.py
def count_id(w0):
    """
    0 -> no terms idd
    1 -> most term idd are shared in root morphem
    2 -> most term idd are shared in flexing morphem
    3 -> most term idd are shared root <-> flexing (crossed)
    :param w0:
    :param w1:
    :return:
    """

    def f(w1):
        count = [set(w0.root).intersection(w1.root),
                 set(w0.flexing).intersection(w1.flexing),
                 set(w0.root).intersection(w1.flexing) | set(w1.root).intersection(w0.flexing)]

        if any(count):
            return max((1,2,3), key=lambda i: len(count[i - 1]))
        else:
            return 0

    return f
def count_id(w0):
    """
    0 -> no terms idd
    1 -> most term idd are shared in root morphem
    2 -> most term idd are shared in flexing morphem
    3 -> most term idd are shared root <-> flexing (crossed)
    :param w0:
    :param w1:
    :return:
    """

    def f(w1):
        count = [set(w0.root).intersection(w1.root),
                 set(w0.flexing).intersection(w1.flexing),
                 set(w0.root).intersection(w1.flexing) | set(w1.root).intersection(w0.flexing)]

        if any(count):
            return max((1,2,3), key=lambda i: len(count[i - 1]))
        else:
            return 0

    return f
0 -> no terms idd
    1 -> most term idd are shared in root morphem
    2 -> most term idd are shared in flexing morphem
    3 -> most term idd are shared root <-> flexing (crossed)
    :param w0:
    :param w1:
    :return: