# Path: dsenser/nnbase.py
# MAX = 1e10
# INF = float('inf')
# UNK_PROB = lambda: np.random.binomial(1, 0.05)
# DIG_RE = re.compile(r"^[\d.]*\d[\d.]*$")
# def _norm_vec(a_x):
# def _norm_word(a_word):
#     def __init__(self, a_w2v=False, a_lstsq=False, a_max_iters=MAX_ITERS):
#     def train(self, a_train_data, a_dev_data=None, a_n_y=-1,
#               a_i=-1, a_train_out=None, a_dev_out=None):
#     def _init_nn(self):
#     def predict(self, a_rel, a_data, a_ret, a_i):
#     def _predict(self, a_args, a_ret, a_i):
#     def _free(self):
#     def _cleanup(self, a_vars):
#     def _generate_ts(self, a_data, a_get_w_emb_i, a_get_c_emb_i):
#     def _rel2x(self, a_rel, a_parses, a_get_w_emb_i, a_get_c_emb_i):
#     def _arg2emb_idx(self, a_parses, a_rel, a_arg, a_get_emb_i):
#     def _init_w_emb(self):
#     def _init_w2v_emb(self):
#     def _init_w2emb(self):
#     def _get_train_w_emb_i(self, a_word):
#     def _get_test_w_emb_i(self, a_word):
#     def _get_train_w2v_emb_i(self, a_word):
#     def _get_test_w2v_emb_i(self, a_word):
#     def _get_test_w2v_lstsq_emb_i(self, a_word):
#     def _init_conn_emb(self):
#     def get_train_c_emb_i(self, a_conn):
#     def get_test_c_emb_i(self, a_conn):
#     def _init_dropout(self, a_input):
#     def _init_funcs(self, a_grads=None):
#     def _init_wemb_funcs(self):
#     def _reset_funcs(self):
#     def _compute_w_stat(self, a_parses):
# class NNBaseSenser(BaseSenser):
# 
# Path: dsenser/constants.py
# CONNECTIVE = "Connective"
# 
# WORDS = "words"
# 
# SENTENCES = "sentences"
# 
# RAW_TEXT = "RawText"


from dsenser.nnbase import _norm_vec, _norm_word, NNBaseSenser, DFLT_VDIM
from dsenser.constants import CONNECTIVE, WORDS, SENTENCES, RAW_TEXT
from pytest import fixture
from mock import patch, MagicMock, Mock
from unittest import TestCase
import dsenser
import dsenser.nnbase
import numpy as np
import pytest
import theano
# Constants
DOC_ID = "wsj_2200"
PARSE1 = {DOC_ID: {
    SENTENCES: [{WORDS: []}, {WORDS: []},
                {WORDS: [["The", {"PartOfSpeech": "DT"}],
                         ["bill", {"PartOfSpeech": "NN"}],
                         ["intends", {"PartOfSpeech": "VBZ"}],
                         ["to", {"PartOfSpeech": "TO"}],
                         ["restrict", {"PartOfSpeech": "VB"}],
                         ["the", {"PartOfSpeech": "DT"}],
                         ["RTC", {"PartOfSpeech": "NNP"}],
                         ["to", {"PartOfSpeech": "TO"}],
                         ["Treasury", {"PartOfSpeech": "NNP"}],
                         ["borrowings", {"PartOfSpeech": "NNS"}],
                         ["only", {"PartOfSpeech": "RB"}],
                         [",", {"PartOfSpeech": ","}],
                         ["unless", {"PartOfSpeech": "IN"}],
                         ["the", {"PartOfSpeech": "DT"}],
                         ["agency", {"PartOfSpeech": "NN"}],
                         ["receives", {"PartOfSpeech": "VBZ"}],
                         ["specific", {"PartOfSpeech": "JJ"}],
                         ["congressional", {"PartOfSpeech": "JJ"}],
                         ["authorization", {"PartOfSpeech": "NN"}],
                         [".", {"PartOfSpeech": "."}]]}]}}

REL1 = {"DocID": "wsj_2200",
        "Arg1": {"CharacterSpanList": [[517, 564]],
                 "RawText": "to restrict the RTC to Treasury"
                 " borrowings only",
                 "TokenList": [[517, 519, 85, 2, 3], [520, 528, 86, 2, 4],

# Path: dsenser/nnbase.py
# MAX = 1e10
# INF = float('inf')
# UNK_PROB = lambda: np.random.binomial(1, 0.05)
# DIG_RE = re.compile(r"^[\d.]*\d[\d.]*$")
# def _norm_vec(a_x):
# def _norm_word(a_word):
#     def __init__(self, a_w2v=False, a_lstsq=False, a_max_iters=MAX_ITERS):
#     def train(self, a_train_data, a_dev_data=None, a_n_y=-1,
#               a_i=-1, a_train_out=None, a_dev_out=None):
#     def _init_nn(self):
#     def predict(self, a_rel, a_data, a_ret, a_i):
#     def _predict(self, a_args, a_ret, a_i):
#     def _free(self):
#     def _cleanup(self, a_vars):
#     def _generate_ts(self, a_data, a_get_w_emb_i, a_get_c_emb_i):
#     def _rel2x(self, a_rel, a_parses, a_get_w_emb_i, a_get_c_emb_i):
#     def _arg2emb_idx(self, a_parses, a_rel, a_arg, a_get_emb_i):
#     def _init_w_emb(self):
#     def _init_w2v_emb(self):
#     def _init_w2emb(self):
#     def _get_train_w_emb_i(self, a_word):
#     def _get_test_w_emb_i(self, a_word):
#     def _get_train_w2v_emb_i(self, a_word):
#     def _get_test_w2v_emb_i(self, a_word):
#     def _get_test_w2v_lstsq_emb_i(self, a_word):
#     def _init_conn_emb(self):
#     def get_train_c_emb_i(self, a_conn):
#     def get_test_c_emb_i(self, a_conn):
#     def _init_dropout(self, a_input):
#     def _init_funcs(self, a_grads=None):
#     def _init_wemb_funcs(self):
#     def _reset_funcs(self):
#     def _compute_w_stat(self, a_parses):
# class NNBaseSenser(BaseSenser):
# 
# Path: dsenser/constants.py
# CONNECTIVE = "Connective"
# 
# WORDS = "words"
# 
# SENTENCES = "sentences"
# 
# RAW_TEXT = "RawText"


# Path: tests/test_nnbase.py
from dsenser.nnbase import _norm_vec, _norm_word, NNBaseSenser, DFLT_VDIM
from dsenser.constants import CONNECTIVE, WORDS, SENTENCES, RAW_TEXT
from pytest import fixture
from mock import patch, MagicMock, Mock
from unittest import TestCase
import dsenser
import dsenser.nnbase
import numpy as np
import pytest
import theano

# Constants
DOC_ID = "wsj_2200"
PARSE1 = {DOC_ID: {
    SENTENCES: [{WORDS: []}, {WORDS: []},
                {WORDS: [["The", {"PartOfSpeech": "DT"}],
                         ["bill", {"PartOfSpeech": "NN"}],
                         ["intends", {"PartOfSpeech": "VBZ"}],
                         ["to", {"PartOfSpeech": "TO"}],
                         ["restrict", {"PartOfSpeech": "VB"}],
                         ["the", {"PartOfSpeech": "DT"}],
                         ["RTC", {"PartOfSpeech": "NNP"}],
                         ["to", {"PartOfSpeech": "TO"}],
                         ["Treasury", {"PartOfSpeech": "NNP"}],
                         ["borrowings", {"PartOfSpeech": "NNS"}],
                         ["only", {"PartOfSpeech": "RB"}],
                         [",", {"PartOfSpeech": ","}],
                         ["unless", {"PartOfSpeech": "IN"}],
                         ["the", {"PartOfSpeech": "DT"}],
                         ["agency", {"PartOfSpeech": "NN"}],
                         ["receives", {"PartOfSpeech": "VBZ"}],
                         ["specific", {"PartOfSpeech": "JJ"}],
                         ["congressional", {"PartOfSpeech": "JJ"}],
                         ["authorization", {"PartOfSpeech": "NN"}],
                         [".", {"PartOfSpeech": "."}]]}]}}

REL1 = {"DocID": "wsj_2200",
        "Arg1": {"CharacterSpanList": [[517, 564]],
                 "RawText": "to restrict the RTC to Treasury"
                 " borrowings only",
                 "TokenList": [[517, 519, 85, 2, 3], [520, 528, 86, 2, 4],

                               [529, 532, 87, 2, 5], [533, 536, 88, 2, 6],