# Path: dsenser/constants.py
# ENCODING = "utf-8"
# 
# DFLT_BROWN_PATH = os.path.join(DATA_DIR, "brown_cluster_1000.txt")
# 
# DFLT_ECONN_PATH = os.path.join(ECONN_DIR, "ExpConn.txt")
# 
# DFLT_INQUIRER_PATH = os.path.join(DATA_DIR, "inquirer_word")
# 
# DFLT_LCSI_PATH = os.path.join(DATA_DIR, "LCSInfomerge.txt")
# 
# DFLT_MPQA_PATH = os.path.join(DATA_DIR, "MPQA_Subjectivity_Lexicon.txt")
# 
# DFLT_W2V_PATH = os.path.join(DATA_DIR, "GoogleNews-vectors-negative300.bin")


from dsenser.constants import ENCODING, DFLT_BROWN_PATH, DFLT_ECONN_PATH, \
    DFLT_INQUIRER_PATH, DFLT_LCSI_PATH, DFLT_MPQA_PATH, DFLT_W2V_PATH
from dsenser.scorer.conn_head_mapper import ConnHeadMapper
from collections import defaultdict
from nltk.stem.porter import PorterStemmer
    from gensim.models.word2vec import Word2Vec
import codecs
import gc
import re
import sys
        Note:
           unloads the resource

        """
        if self.resource is not None:
            print("Unloading resource '{:s}'...".format(repr(self.resource)),
                  file=sys.stderr)
            del self.resource
            self.resource = None
            gc.collect()


##################################################################
# Resources
LCSI = load_LCSI(DFLT_LCSI_PATH)
BROWN_CLUSTERS = LoadOnDemand(load_BROWN, DFLT_BROWN_PATH)
CONNS = load_conns(DFLT_ECONN_PATH)
CONNTOK2CONN = defaultdict(list)

itok = None
for iconn in CONNS:
    for i, ipart in enumerate(iconn):
        itok = ipart[0]
        CONNTOK2CONN[itok].append((i, iconn))

for iconns in CONNTOK2CONN.itervalues():
    iconns.sort(key=lambda el: el[0])

CONNTOKS = set(CONNTOK2CONN.keys())
INQUIRER, STEMMED_INQUIRER = load_INQUIRER(DFLT_INQUIRER_PATH)

# Path: dsenser/constants.py
# ENCODING = "utf-8"
# 
# DFLT_BROWN_PATH = os.path.join(DATA_DIR, "brown_cluster_1000.txt")
# 
# DFLT_ECONN_PATH = os.path.join(ECONN_DIR, "ExpConn.txt")
# 
# DFLT_INQUIRER_PATH = os.path.join(DATA_DIR, "inquirer_word")
# 
# DFLT_LCSI_PATH = os.path.join(DATA_DIR, "LCSInfomerge.txt")
# 
# DFLT_MPQA_PATH = os.path.join(DATA_DIR, "MPQA_Subjectivity_Lexicon.txt")
# 
# DFLT_W2V_PATH = os.path.join(DATA_DIR, "GoogleNews-vectors-negative300.bin")


# Path: dsenser/resources.py
from dsenser.constants import ENCODING, DFLT_BROWN_PATH, DFLT_ECONN_PATH, \
    DFLT_INQUIRER_PATH, DFLT_LCSI_PATH, DFLT_MPQA_PATH, DFLT_W2V_PATH
from dsenser.scorer.conn_head_mapper import ConnHeadMapper
from collections import defaultdict
from nltk.stem.porter import PorterStemmer
    from gensim.models.word2vec import Word2Vec
import codecs
import gc
import re
import sys

        Note:
           unloads the resource

        """
        if self.resource is not None:
            print("Unloading resource '{:s}'...".format(repr(self.resource)),
                  file=sys.stderr)
            del self.resource
            self.resource = None
            gc.collect()


##################################################################
# Resources
LCSI = load_LCSI(DFLT_LCSI_PATH)
BROWN_CLUSTERS = LoadOnDemand(load_BROWN, DFLT_BROWN_PATH)
CONNS = load_conns(DFLT_ECONN_PATH)
CONNTOK2CONN = defaultdict(list)

itok = None
for iconn in CONNS:
    for i, ipart in enumerate(iconn):
        itok = ipart[0]
        CONNTOK2CONN[itok].append((i, iconn))

for iconns in CONNTOK2CONN.itervalues():
    iconns.sort(key=lambda el: el[0])

CONNTOKS = set(CONNTOK2CONN.keys())
INQUIRER, STEMMED_INQUIRER = load_INQUIRER(DFLT_INQUIRER_PATH)

MPQA = load_MPQA(DFLT_MPQA_PATH)