# New Generate Test Cases 
from solutions import *
import numpy as np 
import math 
import os,sys
# import copy 
# from keras.callbacks import History 
# import tensorflow as tf
sys.path.append('../')
sys.path.append('../../')

from grader_support import stdout_redirector
from grader_support import util

os.environ['TF_CPP_MIN_LOG_LEVEL']='3'


mFiles = [
    "cosine_similarity.py",
    "complete_analogy.py",
]

np.random.seed(3)

d = {'pursuivant': np.array([-0.13648  , -0.32336  , -0.91659  , -1.5343   ,  0.71727  ,
       -1.3972   ,  2.2791   ,  0.89844  ,  1.0777   , -0.10456  ,
        0.33791  ,  0.57295  ,  0.6847   , -0.23093  , -1.0492   ,
       -0.7812   ,  0.19778  ,  0.92813  , -0.2945   , -0.037263 ,
        0.79949  ,  0.18913  , -0.034523 , -1.6484   , -1.6933   ,
       -0.58301  , -0.47646  ,  1.2462   , -0.5215   ,  0.53559  ,
       -1.0501   , -0.031223 , -0.24685  ,  0.48308  ,  0.0040414,
        0.65939  , -1.0626   , -0.93032  ,  0.68599  , -1.4787   ,
        0.69818  ,  0.62244  ,  0.12085  , -1.4218   , -0.55545  ,
       -0.31841  ,  0.40133  , -0.1877   , -0.36294  , -1.3418   ]), 'villaran': np.array([-0.40261 , -0.50308 ,  0.11266 ,  0.47506 , -0.2698  , -0.066715,
        0.096496,  0.83573 , -0.055321, -0.12376 ,  0.067504, -0.83156 ,
        0.90217 ,  0.36186 ,  0.28217 , -0.053142,  0.61577 , -0.5019  ,
        1.0521  , -0.20796 , -0.9207  , -0.16474 , -0.5308  ,  0.39056 ,
        1.0834  ,  1.023   ,  0.5557  , -0.28453 , -0.48533 ,  0.64407 ,
       -1.494   ,  0.021205, -0.092784, -0.051822, -0.35572 , -0.063281,
       -0.32386 ,  0.50062 ,  0.39156 ,  0.33686 , -0.49054 ,  0.57443 ,
       -0.25148 , -0.15374 ,  0.46754 , -0.80154 ,  0.22113 , -0.077624,
        0.647   ,  0.47102 ]), 'afhq': np.array([ 0.53098  , -0.80356  ,  0.63852  , -0.51475  , -0.15449  ,
       -1.5122   ,  0.9389   ,  0.24354  , -0.6317   , -0.89928  ,
       -0.060159 , -0.70439  ,  0.44719  , -0.24145  , -0.75044  ,
        0.42972  , -0.69866  ,  0.4016   ,  0.21491  ,  0.45674  ,
       -0.20866  , -0.24596  ,  0.0031839, -0.083632 , -0.72579  ,
        1.0855   ,  0.49908  , -0.11467  , -0.17569  ,  0.75408  ,
       -0.89428  , -0.30991  , -0.40079  , -0.013176 , -0.72269  ,
       -0.056882 , -0.091163 , -0.40124  , -0.45752  ,  0.39603  ,
        0.56614  , -0.5364   ,  0.14301  ,  0.026913 , -0.66937  ,
        0.49106  , -0.32581  , -0.31405  , -1.0336   , -0.18008  ]), 'fantastic': np.array([ 0.3333  ,  0.30612 , -0.63572 ,  0.051507,  0.78602 , -0.48425 ,
       -0.21684 , -0.1168  , -0.10738 ,  0.91883 , -0.081054,  0.73025 ,
       -0.78696 ,  0.25925 ,  0.79365 , -0.53968 ,  1.2594  ,  0.62911 ,
       -1.185   , -0.63767 , -0.27612 ,  0.68748 , -0.049664, -0.15773 ,
        1.2352  , -0.021032, -1.2503  ,  0.2495  ,  0.69357 , -0.19549 ,
        1.6106  ,  0.70615 ,  0.10677 , -0.31279 , -0.20057 ,  0.72469 ,
        0.11066 ,  0.3869  , -0.43106 , -0.99054 ,  0.16137 , -0.41234 ,
       -0.35022 , -0.16584 , -0.33375 ,  0.46223 ,  0.2872  ,  0.14707 ,
        0.54889 ,  0.16369 ]), 'stuttgarter': np.array([-0.50955 , -1.1476  , -0.586   , -0.83522 , -0.75855 , -0.25805 ,
       -0.75688 ,  1.1233  , -0.24896 , -0.18953 ,  0.57624 , -0.47329 ,
       -0.31341 , -0.026954, -0.43877 , -1.5212  , -0.042523,  0.56638 ,
       -1.0062  ,  0.75813 , -0.32075 , -0.89006 ,  0.96887 ,  1.4227  ,
       -0.33733 ,  0.12367 , -1.1976  ,  0.35556 ,  0.29301 , -0.26443 ,
       -0.74345 ,  0.28694 ,  0.31767 ,  1.1837  , -0.62699 , -0.37567 ,
        0.076536,  0.55794 ,  0.61395 ,  1.1676  ,  1.8369  , -0.92562 ,
       -0.32736 ,  0.37398 , -0.080528,  0.26458 , -0.28498 ,  3.3287  ,
        0.18334 ,  0.32584 ]), 'ojo': np.array([-0.63686 ,  0.41181 , -1.4589  ,  1.9792  , -0.29009 , -1.6778  ,
        0.33873 ,  0.21582 , -0.33524 ,  0.013346, -0.54925 ,  0.63686 ,
        0.22764 ,  0.65606 ,  0.27749 , -0.27824 ,  0.47274 , -0.9366  ,
        0.61049 ,  0.36825 , -1.3076  ,  1.2877  ,  0.67761 ,  0.50116 ,
       -0.45755 ,  1.8329  , -0.19165 , -0.18298 ,  0.4645  ,  1.291   ,
        0.084926, -1.0717  , -1.2867  ,  1.8005  ,  0.53937 ,  0.052519,
        0.017464, -1.243   ,  1.3731  ,  1.0074  ,  0.20999 ,  0.56117 ,
        0.1249  ,  0.90613 , -0.25918 ,  0.43458 , -0.1135  ,  0.20548 ,
        1.3328  ,  0.17734 ]), 'safrole': np.array([-0.056604, -0.27681 ,  0.61062 , -0.51454 , -0.6895  ,  0.47962 ,
        0.27797 ,  0.14565 ,  1.0907  ,  1.1291  ,  0.48951 ,  0.18394 ,
        1.2755  , -0.073016, -0.55865 ,  0.64033 ,  0.4357  ,  0.20435 ,
        0.29956 ,  0.56403 , -0.33319 , -0.78834 ,  0.51737 ,  0.016081,
        0.3438  ,  0.29654 ,  0.51401 ,  0.64383 ,  1.0954  ,  0.51688 ,
       -1.4204  , -0.13864 ,  0.066039, -0.19696 ,  0.21482 ,  0.21129 ,
       -0.095891,  0.16873 , -0.061557,  0.50999 , -0.14176 ,  0.23621 ,
       -0.29082 ,  0.013112,  0.027957,  0.2022  , -0.47505 , -0.028703,
        0.40289 , -0.51492 ]), 'kette': np.array([-0.85066 , -0.7159  ,  0.22399 , -0.24156 , -0.33906 , -0.21177 ,
        0.58644 ,  0.92323 ,  0.015982,  0.081562,  0.14588 ,  0.32739 ,
       -0.062476,  0.11624 ,  0.15714 , -0.4664  ,  0.48864 ,  0.13282 ,
        0.84737 ,  0.12374 , -0.20044 , -0.10058 , -0.034266, -0.1403  ,
        0.52284 ,  1.2843  , -0.02867 , -0.15816 ,  0.089804,  0.26402 ,
       -1.4842  , -0.63547 ,  0.55904 ,  0.58881 , -0.85034 ,  0.37174 ,
        0.20329 , -0.28296 ,  0.16659 ,  0.18303 ,  0.12657 , -0.18965 ,
       -0.56698 , -0.42887 ,  0.10995 , -0.41366 , -0.12741 , -0.32587 ,
       -0.62187 ,  0.32581 ]), 'legerdemain': np.array([-0.49936 , -1.2411  , -0.70649 ,  0.45057 , -0.37436 ,  0.21668 ,
        1.0298  ,  0.34018 ,  0.49105 ,  0.35335 , -0.43973 ,  0.33745 ,
        0.26364 ,  0.42547 , -0.25835 ,  0.21418 ,  0.62817 , -0.35251 ,
        0.81946 , -0.3714  ,  0.15607 ,  0.13716 ,  0.034591, -0.68181 ,
        0.25987 ,  0.86315 , -1.2554  , -0.59729 ,  0.44129 ,  0.62309 ,
       -0.49832 , -0.29734 ,  0.082235,  0.40138 ,  0.3259  ,  0.67977 ,
       -0.98732 ,  0.63233 ,  0.042146, -0.36166 , -0.21727 ,  0.059784,
        0.011296,  1.3433  , -0.55062 , -0.29982 ,  0.85784 ,  1.3315  ,
       -0.32958 ,  0.013188]), 'bewail': np.array([  2.02300000e-01,   1.37670000e-01,   6.93120000e-01,
        -3.12950000e-01,   3.80540000e-02,  -8.00100000e-02,
         5.21760000e-01,   8.68420000e-01,   1.10210000e+00,
         2.31960000e-01,   3.61240000e-01,   4.94650000e-01,
        -4.35710000e-01,  -8.52580000e-02,  -3.91010000e-01,
         9.68200000e-04,  -1.46790000e-01,   1.67690000e-01,
         9.44450000e-01,  -2.40290000e-01,   2.32530000e-01,
         1.81000000e-02,   2.68360000e-01,   7.33350000e-02,
         8.78050000e-01,   4.57030000e-01,  -2.15070000e-01,
        -1.55560000e-02,   2.95430000e-01,  -4.46170000e-01,
        -1.47730000e+00,   1.43550000e+00,   1.58450000e-01,
        -4.51390000e-01,  -6.94710000e-01,  -1.45250000e-01,
        -3.63640000e-01,  -2.75890000e-01,  -2.48610000e-01,
         4.85880000e-01,   4.67430000e-01,  -1.17190000e+00,
        -4.50920000e-01,   4.29580000e-01,  -3.62210000e-01,
        -6.47930000e-01,   2.32530000e-01,   6.57250000e-01,
        -1.74790000e-01,  -4.14400000e-01]), 'jacaranda': np.array([-0.078031 ,  0.66091  , -0.52212  , -0.21876  , -0.091462 ,
       -0.68891  , -0.63285  , -1.315    , -0.096502 , -0.024935 ,
       -0.3284   , -0.15751  ,  0.77287  , -0.91169  , -0.50055  ,
       -0.1451   , -0.45939  ,  0.86599  ,  0.55295  , -0.33344  ,
       -0.65468  , -0.28861  , -0.35458  , -0.21568  ,  0.46595  ,
        1.4247   ,  0.38921  ,  1.0829   , -0.41168  , -0.12059  ,
       -0.27789  ,  0.23522  ,  0.0094553,  0.43089  , -0.21108  ,
        0.15284  ,  0.16143  , -0.85432  , -0.31323  , -0.22619  ,
       -0.23124  , -1.2713   , -1.2284   , -0.16185  ,  0.99928  ,
       -0.39963  ,  0.0035931, -0.59366  ,  0.80196  , -0.66543  ]), 'haseley': np.array([-1.4347  ,  0.20575 , -1.732   ,  0.51585 ,  0.39565 , -0.31659 ,
        1.2428  ,  1.6892  ,  0.050026, -0.40844 , -0.79636 , -0.055379,
        0.60127 , -0.89393 , -0.3252  ,  0.02444 ,  0.41073 ,  0.58097 ,
        0.13357 , -0.35081 ,  0.3364  , -0.051527, -1.0755  , -0.6867  ,
        0.97024 ,  0.18858 , -0.31732 ,  0.45335 ,  0.35708 , -0.12374 ,
       -1.0983  , -0.087276,  1.5077  ,  0.3286  ,  0.091927,  0.34424 ,
       -0.19914 ,  0.52972 ,  0.2059  ,  0.5156  , -0.33331 ,  0.26901 ,
       -0.58417 ,  0.76165 , -0.19704 ,  0.31709 ,  0.02883 , -0.065241,
       -0.70475 ,  0.058118]), 'buccinator': np.array([-0.22861  , -0.46818  ,  0.21334  , -0.25846  , -1.0519   ,
        0.602    ,  0.96512  ,  0.15314  ,  0.38865  ,  0.42587  ,
        1.2212   ,  0.30396  , -0.58748  ,  0.36276  , -1.2863   ,
       -0.26898  , -0.20993  ,  0.62708  , -0.14232  , -0.046718 ,
       -1.083    , -0.43975  , -0.26489  ,  0.50958  , -0.21859  ,
        1.2991   , -0.052586 ,  0.11751  ,  0.33204  , -0.54345  ,
       -1.0511   ,  0.63912  ,  0.26517  ,  0.35931  , -0.49959  ,
        0.0092442,  0.43539  , -0.57454  ,  0.35829  ,  0.07201  ,
        0.97662  , -0.94236  , -0.54374  , -0.28324  , -0.3809   ,
       -0.023993 ,  0.77095  , -0.48494  , -0.4816   ,  0.68831  ]), 'shards': np.array([ 0.71799 , -0.34384 ,  0.2019  , -0.28885 ,  0.62331 ,  0.46421 ,
        0.24469 ,  0.22792 ,  0.068261, -0.24096 ,  0.038203, -0.4548  ,
       -0.18157 ,  0.77576 , -0.047025, -0.011271, -0.49527 , -0.42226 ,
       -0.2556  , -1.3005  ,  0.26983 ,  0.21088 , -0.22026 , -0.84124 ,
        0.48152 ,  0.39863 , -1.0697  ,  1.2075  ,  0.82633 , -0.72164 ,
        0.56384 , -0.8468  ,  0.95252 ,  0.12169 , -0.45382 ,  1.3513  ,
        0.29161 ,  0.26772 ,  0.94841 ,  0.86687 ,  0.5961  , -0.020455,
        0.38269 ,  0.26131 ,  1.2168  ,  0.93614 ,  0.472   , -0.3626  ,
       -0.60097 , -2.2747  ]), 'b-grade': np.array([-0.8609   , -0.44712  , -0.27446  , -0.79703  , -0.71908  ,
        0.10183  ,  0.70082  , -0.31224  ,  0.23362  ,  0.64631  ,
       -0.30447  ,  0.2614   ,  0.12329  ,  1.3967   ,  0.024219 ,
       -0.38552  ,  0.4673   ,  0.96459  , -0.28215  ,  0.52417  ,
        0.78773  ,  0.14975  ,  0.027833 ,  0.64056  , -0.26983  ,
        0.32098  , -0.545    ,  0.32106  ,  0.081269 ,  0.19013  ,
       -1.1679   ,  0.34142  ,  0.47435  , -0.0056714,  0.5998   ,
        1.2032   ,  0.14962  , -0.25349  , -1.0573   , -1.2133   ,
       -0.4207   , -0.54607  ,  0.69367  ,  0.19088  , -0.5349   ,
       -0.012231 ,  0.60467  ,  0.69159  ,  0.91687  , -0.5041   ]), 'musburger': np.array([-1.4283  ,  0.16758 , -0.47018 ,  0.82724 ,  0.97079 ,  0.21426 ,
       -0.92678 , -0.40753 , -0.23062 ,  0.12891 ,  0.95236 ,  0.88535 ,
       -0.31684 ,  0.77579 ,  0.47733 ,  1.1553  ,  0.24857 ,  0.17023 ,
       -1.001   ,  0.34208 ,  0.37645 ,  1.0186  ,  0.56251 , -0.43753 ,
       -0.047782,  0.25857 ,  1.4755  ,  1.0392  ,  1.6308  , -0.32552 ,
       -1.4243  ,  0.025256,  0.54655 , -0.18552 ,  0.33294 , -0.2386  ,
       -0.23484 , -0.086404, -1.176   ,  0.6914  ,  0.56057 ,  0.47543 ,
        0.023505, -0.40302 ,  0.012691, -0.15688 ,  0.19542 ,  1.3228  ,
       -1.4608  ,  1.0201  ]), 'notified': np.array([ 0.62376 , -0.75815 ,  0.089605,  0.42228 ,  0.13514 , -0.45574 ,
       -0.86543 ,  1.0435  ,  0.52532 , -1.4878  ,  0.48253 ,  0.24104 ,
        0.19165 , -0.47256 ,  0.833   ,  0.50503 , -1.0043  , -0.04769 ,
        0.22545 , -0.07572 ,  0.65528 ,  0.096368,  0.42306 ,  0.085978,
       -0.1165  , -1.347   ,  0.44875 , -0.16913 , -0.72993 , -0.58753 ,
        0.81646 , -0.46654 , -0.44232 , -1.0399  ,  0.26699 , -0.36237 ,
        0.94474 , -0.29005 ,  0.10662 , -0.074245, -0.096851, -0.59159 ,
        0.53484 ,  0.31644 , -0.14752 , -0.19137 , -0.65545 ,  1.0109  ,
        0.21755 ,  0.29185 ]), 'pranked': np.array([-0.27447  , -1.1432   ,  0.57435  , -0.53883  , -0.55628  ,
       -0.32994  , -0.19057  ,  0.44151  ,  0.16291  ,  0.29067  ,
        0.38809  ,  0.72596  ,  0.18337  ,  0.30772  ,  0.1491   ,
       -0.20821  , -0.09548  ,  0.28101  ,  0.32209  , -0.2647   ,
       -0.51715  , -0.12852  ,  0.63564  ,  0.43983  ,  0.74979  ,
        0.88926  ,  0.0086555,  0.15207  ,  0.0076686, -0.011641 ,
       -1.3029   ,  0.30404  ,  0.8561   , -0.16169  , -0.50378  ,
        0.091735 ,  0.50758  , -0.15638  , -1.0251   , -0.79437  ,
        0.079466 , -0.7838   , -0.26636  ,  0.4992   , -0.059185 ,
       -0.743    , -0.42374  , -0.17468  ,  0.41427  ,  0.36044  ]), 'yaphe': np.array([ -1.02430000e+00,   3.57800000e-01,  -3.07450000e-01,
         5.02070000e-01,   5.85570000e-01,   4.45020000e-01,
         8.34830000e-01,   8.72170000e-01,   5.59460000e-01,
        -1.28290000e+00,  -5.10880000e-01,  -8.76870000e-01,
        -5.35340000e-03,   4.02950000e-01,  -1.00480000e-01,
        -3.91440000e-01,   9.49930000e-01,   2.45450000e-01,
         8.02000000e-01,   3.23390000e-01,  -5.10060000e-01,
         8.18730000e-01,  -5.41060000e-01,  -5.96140000e-02,
        -3.36630000e-01,   2.57250000e-01,   2.59870000e-01,
         5.09460000e-01,  -3.35070000e-01,   2.83060000e-01,
        -2.14290000e+00,  -9.43500000e-01,   4.76710000e-01,
        -1.39560000e-01,  -1.08800000e+00,  -1.36530000e-01,
        -6.70130000e-01,   3.63520000e-01,   1.38460000e+00,
         1.28400000e-04,   6.12660000e-01,   2.09160000e-01,
         9.25030000e-01,  -1.43200000e-01,   3.30550000e-01,
        -2.11800000e-01,   2.52800000e-01,   8.69550000e-01,
        -1.00700000e+00,   1.43340000e+00]), '1h24': np.array([-0.34633 ,  0.50454 , -0.86025 ,  0.57096 , -0.3095  , -0.11699 ,
        1.9929  , -0.51506 , -0.07715 ,  0.018544,  0.034566, -0.51917 ,
        1.094   ,  0.42041 , -0.63229 ,  0.62602 , -0.6682  ,  0.48521 ,
        0.66027 , -0.073988,  0.073898, -0.28117 , -0.13631 ,  0.98756 ,
        0.22947 ,  1.2216  ,  0.35325 ,  0.4046  ,  0.74782 ,  0.28767 ,
       -0.38537 ,  0.10428 , -0.24377 ,  0.27679 , -0.6413  , -0.025187,
        0.19751 , -0.50443 , -0.38569 ,  0.017954,  1.2157  , -0.92861 ,
        0.17659 ,  0.66615 ,  0.2623  , -0.14838 ,  1.4899  ,  0.14031 ,
        0.236   ,  0.29638 ])}

# generating test cases for cosine_similarity
u1 = d['pranked']
v1 = d['notified']
cs = cosine_similarity(u1,v1)
# generating test cases for complete_analogy

w1 = 'notified'
w2 = 'pranked'
w3 = 'musburger'
ca = complete_analogy(w1,w2,w3,d)
# generating test cases for neutralize
# gender = np.asarray([-0.087144  ,  0.2182  ,   -0.40986 ,   -0.03922 ,   -0.1032    ,  0.94165,
#  -0.06042  ,   0.32988 ,    0.46144 ,   -0.35962 ,    0.31102  ,  -0.86824,
#   0.96006  ,   0.01073 ,    0.24337 ,    0.08193 ,   -1.02722  ,  -0.21122,
#   0.695044 ,  -0.00222 ,    0.29106 ,    0.5053  ,   -0.099454 ,   0.40445,
#   0.30181  ,   0.1355  ,   -0.0606  ,   -0.07131 ,   -0.19245  ,  -0.06115,
#  -0.3204   ,   0.07165 ,   -0.13337 ,   -0.25068714, -0.14293  ,  -0.224957,
#  -0.149    ,   0.048882,    0.12191 ,   -0.27362 ,   -0.165476 ,  -0.20426,
#   0.54376  ,  -0.271425,   -0.10245 ,   -0.32108 ,    0.2516   ,  -0.33455,
#  -0.04371  ,   0.01258   ])

# v = neutralize("pranked", gender,d)
# generating test cases 
# ue, u2 = equalize(("musburger", "pranked"), gender, d)

# set the seed to be able to replicate the same results. 
np.random.seed(3)


def generateTestCases():
	testCases = {
	    'cosine_similarity': {
	        'partId': 'rUmJJ',
	        'testCases': [
	            {
	                'testInput': (u1,v1),
	                'testOutput': cs
	            }
	        ]
	    },
	    'complete_analogy': { 
	        'partId': 'WQvOv',
	        'testCases': [
	            {
	                'testInput': (w1,w2,w3,d),
	                'testOutput': ca
	            }
	        ]
	    }
	}
	return testCases

