# Path: dsenser/constants.py
# ARG1 = "Arg1"
# 
# ARG2 = "Arg2"
# 
# CHAR_SPAN = "CharacterSpanList"
# 
# CONNECTIVE = "Connective"
# 
# ENCODING = "utf-8"
# 
# RAW_TEXT = "RawText"
# 
# SENSE = "Sense"
# 
# TOK_LIST = "TokenList"
# 
# TOK_OFFS_IDX = 2
# 
# TYPE = "Type"
# 
# DFLT_MODEL_PATH = os.path.join(MODEL_DIR, "pdtb.sense.model")
# 
# DFLT_MODEL_TYPE = WANG
# 
# DFLT_ECONN_PATH = os.path.join(ECONN_DIR, "ExpConn.txt")
# 
# ALT_LEX = "AltLex"
# 
# EXPLICIT = "Explicit"
# 
# IMPLICIT = "Implicit"
# 
# SVD = 1
# 
# LSTM = 2
# 
# MJR = 4
# 
# WANG = 8
# 
# XGBOOST = 16
# 
# PARSE_TREE = "parsetree"
# 
# DEPS = "dependencies"
# 
# WORDS = "words"
# 
# SENTENCES = "sentences"
# 
# SHORT2FULL = {"Expansion": "Expansion.Conjunction",
#               "Comparison": "Comparison.Contrast",
#               "Comparison.COntrast": "Comparison.Contrast"}
# 
# Path: dsenser/utils.py
# class timeit(object):
#     """Decorator class for measuring time performance.
# 
#     Attributes:
#       msg (str): message to be printed on method invocation
# 
#     """
# 
#     def __init__(self, a_msg):
#         """Class constructor.
# 
#         Args:
#           a_msg (str): debug message to print
# 
#         """
#         self.msg = a_msg
# 
#     def __call__(self, a_func):
#         """Decorator function.
# 
#         Args:
#           a_func (method): decorated method
# 
#         Returns:
#           method: wrapped method
# 
#         """
#         def _wrapper(*args, **kwargs):
#             print(self.msg + " started", file=sys.stderr)
#             start_time = datetime.utcnow()
#             a_func(*args, **kwargs)
#             end_time = datetime.utcnow()
#             time_delta = (end_time - start_time).total_seconds()
#             print(self.msg + " finished ({:.2f} sec)".format(time_delta),
#                   file=sys.stderr)
#         return wraps(a_func)(_wrapper)


from dsenser.constants import ARG1, ARG2, CHAR_SPAN, CONNECTIVE, ENCODING, \
    RAW_TEXT, SENSE, TOK_LIST, TOK_OFFS_IDX, TYPE, DFLT_MODEL_PATH, \
    DFLT_MODEL_TYPE, DFLT_ECONN_PATH, ALT_LEX, EXPLICIT, IMPLICIT, SVD, \
    LSTM, MJR, WANG, XGBOOST, PARSE_TREE, DEPS, WORDS, SENTENCES, SHORT2FULL
from dsenser.utils import timeit
from collections import Iterable
from cPickle import dump, load
from itertools import chain
            from dsenser.major import MajorSenser
            from dsenser.wang import WangSenser
            from dsenser.xgboost import XGBoostSenser
            from dsenser.svd import SVDSenser
            from dsenser.lstm import LSTMSenser
                from dsenser.svd import SVDSenser
                from dsenser.lstm import LSTMSenser
import codecs
import gc
import numpy as np
import os
import sys
          a_type (str):
            type of the model to be trained
          a_dev_data (list or None):
            development set
          a_grid_search (bool):
            use grid search in order to determine hyper-paramaters of
            the model
          a_w2v (bool):
            use word2vec embeddings
          a_lstsq (bool):
            use least squares method

        Returns:
          void:

        """
        if a_type == 0:
            raise RuntimeError("No model type specified.")
        if a_dev_data is None:
            a_dev_data = ([], {})
        # initialize models
        if a_type & MJR:
            self.models.append(MajorSenser())
        if a_type & WANG:
            self.models.append(WangSenser(a_grid_search=a_grid_search))
        if a_type & XGBOOST:
            self.models.append(XGBoostSenser(a_grid_search=a_grid_search))
        # NN models have to go last, since we are pruning the parses for them
        # to free some memory
        nn_used = False

# Path: dsenser/constants.py
# ARG1 = "Arg1"
# 
# ARG2 = "Arg2"
# 
# CHAR_SPAN = "CharacterSpanList"
# 
# CONNECTIVE = "Connective"
# 
# ENCODING = "utf-8"
# 
# RAW_TEXT = "RawText"
# 
# SENSE = "Sense"
# 
# TOK_LIST = "TokenList"
# 
# TOK_OFFS_IDX = 2
# 
# TYPE = "Type"
# 
# DFLT_MODEL_PATH = os.path.join(MODEL_DIR, "pdtb.sense.model")
# 
# DFLT_MODEL_TYPE = WANG
# 
# DFLT_ECONN_PATH = os.path.join(ECONN_DIR, "ExpConn.txt")
# 
# ALT_LEX = "AltLex"
# 
# EXPLICIT = "Explicit"
# 
# IMPLICIT = "Implicit"
# 
# SVD = 1
# 
# LSTM = 2
# 
# MJR = 4
# 
# WANG = 8
# 
# XGBOOST = 16
# 
# PARSE_TREE = "parsetree"
# 
# DEPS = "dependencies"
# 
# WORDS = "words"
# 
# SENTENCES = "sentences"
# 
# SHORT2FULL = {"Expansion": "Expansion.Conjunction",
#               "Comparison": "Comparison.Contrast",
#               "Comparison.COntrast": "Comparison.Contrast"}
# 
# Path: dsenser/utils.py
# class timeit(object):
#     """Decorator class for measuring time performance.
# 
#     Attributes:
#       msg (str): message to be printed on method invocation
# 
#     """
# 
#     def __init__(self, a_msg):
#         """Class constructor.
# 
#         Args:
#           a_msg (str): debug message to print
# 
#         """
#         self.msg = a_msg
# 
#     def __call__(self, a_func):
#         """Decorator function.
# 
#         Args:
#           a_func (method): decorated method
# 
#         Returns:
#           method: wrapped method
# 
#         """
#         def _wrapper(*args, **kwargs):
#             print(self.msg + " started", file=sys.stderr)
#             start_time = datetime.utcnow()
#             a_func(*args, **kwargs)
#             end_time = datetime.utcnow()
#             time_delta = (end_time - start_time).total_seconds()
#             print(self.msg + " finished ({:.2f} sec)".format(time_delta),
#                   file=sys.stderr)
#         return wraps(a_func)(_wrapper)


# Path: dsenser/dsenser.py
from dsenser.constants import ARG1, ARG2, CHAR_SPAN, CONNECTIVE, ENCODING, \
    RAW_TEXT, SENSE, TOK_LIST, TOK_OFFS_IDX, TYPE, DFLT_MODEL_PATH, \
    DFLT_MODEL_TYPE, DFLT_ECONN_PATH, ALT_LEX, EXPLICIT, IMPLICIT, SVD, \
    LSTM, MJR, WANG, XGBOOST, PARSE_TREE, DEPS, WORDS, SENTENCES, SHORT2FULL
from dsenser.utils import timeit
from collections import Iterable
from cPickle import dump, load
from itertools import chain
            from dsenser.major import MajorSenser
            from dsenser.wang import WangSenser
            from dsenser.xgboost import XGBoostSenser
            from dsenser.svd import SVDSenser
            from dsenser.lstm import LSTMSenser
                from dsenser.svd import SVDSenser
                from dsenser.lstm import LSTMSenser
import codecs
import gc
import numpy as np
import os
import sys

          a_type (str):
            type of the model to be trained
          a_dev_data (list or None):
            development set
          a_grid_search (bool):
            use grid search in order to determine hyper-paramaters of
            the model
          a_w2v (bool):
            use word2vec embeddings
          a_lstsq (bool):
            use least squares method

        Returns:
          void:

        """
        if a_type == 0:
            raise RuntimeError("No model type specified.")
        if a_dev_data is None:
            a_dev_data = ([], {})
        # initialize models
        if a_type & MJR:
            self.models.append(MajorSenser())
        if a_type & WANG:
            self.models.append(WangSenser(a_grid_search=a_grid_search))
        if a_type & XGBOOST:
            self.models.append(XGBoostSenser(a_grid_search=a_grid_search))
        # NN models have to go last, since we are pruning the parses for them
        # to free some memory
        nn_used = False

        if a_type & SVD: