# 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
        self.models = []
        self._dump(self, a_path)

    def predict(self, a_data):
        """Determine senses of discourse connectives.

        This is a memory-optimized version of prediction function.  Due to
        these optimizations, however, it does not support the judge model.

        Args:
          a_data (list):
            input data to be analyzed

        Returns:
          void: updates input set in place

        """
        if not self.model_paths:
            raise RuntimeError(
                "No paths to trained models are provided to make predictions.")

        rels = a_data[0]
        # normalize input relations
        self._preprocess_rels(rels)
        # predict sense
        imodel = isense = None
        # allocate space for predictions
        self.wbench = np.zeros((len(rels), len(self.cls2idx)))
        # iterate over each trained model and sum up their predictions
        for ipath in self.model_paths:

# 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

        self.models = []
        self._dump(self, a_path)

    def predict(self, a_data):
        """Determine senses of discourse connectives.

        This is a memory-optimized version of prediction function.  Due to
        these optimizations, however, it does not support the judge model.

        Args:
          a_data (list):
            input data to be analyzed

        Returns:
          void: updates input set in place

        """
        if not self.model_paths:
            raise RuntimeError(
                "No paths to trained models are provided to make predictions.")

        rels = a_data[0]
        # normalize input relations
        self._preprocess_rels(rels)
        # predict sense
        imodel = isense = None
        # allocate space for predictions
        self.wbench = np.zeros((len(rels), len(self.cls2idx)))
        # iterate over each trained model and sum up their predictions
        for ipath in self.model_paths:

            print("ipath = {:s}".format(ipath).encode(ENCODING),