# 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
      judge (dsenser.Judge):
        meta-classifier
      cls2idx (dict):
        mapping from class to index
      idx2cls (dict):
        mapping from index to class
      econn (set):
        connectives marking explicit relations

    """

    def __init__(self, a_model=None):
        """
        Class constructor.

        Args:
          a_model (str or None): path to serialized model or None

        """
        self.models = []
        self.model_paths = []
        self.judge = None
        self.cls2idx = {}
        self.idx2cls = {}
        self.wbench = None
        self.econn = set([self._normalize_conn(iconn) for iconn in DFLT_CONN])
        # load serialized model
        if a_model is not None:
            self._load(a_model)


# 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

      judge (dsenser.Judge):
        meta-classifier
      cls2idx (dict):
        mapping from class to index
      idx2cls (dict):
        mapping from index to class
      econn (set):
        connectives marking explicit relations

    """

    def __init__(self, a_model=None):
        """
        Class constructor.

        Args:
          a_model (str or None): path to serialized model or None

        """
        self.models = []
        self.model_paths = []
        self.judge = None
        self.cls2idx = {}
        self.idx2cls = {}
        self.wbench = None
        self.econn = set([self._normalize_conn(iconn) for iconn in DFLT_CONN])
        # load serialized model
        if a_model is not None:
            self._load(a_model)


    def train(self, a_train_data, a_type=DFLT_MODEL_TYPE,