# Path: broca/common/util.py
# def penn_to_wordnet(tag):
# def gram_size(term):
# def build_sim_mat(items, sim_func):
# def sim_to_dist(sim_mat):
# def dist_to_sim(dist_mat):
# def parallel(func, inputs, n_jobs, expand_args=False):


import unittest
import numpy as np
from broca.common import util


class UtilTest(unittest.TestCase):
    def test_sim_mat(self):
        def sim_func(a, b):
            return a * b

        items = [1,2,3,4]
        expected = np.array([
            [1., 2., 3., 4.],
            [2., 1., 6., 8.],
            [3., 6., 1., 12.],
            [4., 8., 12., 1.]
        ])


# Path: broca/common/util.py
# def penn_to_wordnet(tag):
# def gram_size(term):
# def build_sim_mat(items, sim_func):
# def sim_to_dist(sim_mat):
# def dist_to_sim(dist_mat):
# def parallel(func, inputs, n_jobs, expand_args=False):


# Path: tests/test_util.py
import unittest
import numpy as np
from broca.common import util



class UtilTest(unittest.TestCase):
    def test_sim_mat(self):
        def sim_func(a, b):
            return a * b

        items = [1,2,3,4]
        expected = np.array([
            [1., 2., 3., 4.],
            [2., 1., 6., 8.],
            [3., 6., 1., 12.],
            [4., 8., 12., 1.]
        ])


        sim_mat = util.build_sim_mat(items, sim_func)