def loadWeightedLexiconFromTopicFile(filename):
    """Loads a weighted lexicon 
    returns a dictionary of dictionaries"""
    lexFile = open(filename, 'r')
    lexicon = {}
    for line in lexFile.readlines():
        line_split = line.split('\t')
        if len(line_split) > 1:
            category = str(line_split[0])
            weight = line_split[1]
            terms = line_split[2]
            lexicon[category] = {}
            term_split = terms.split(' ')
            for term in term_split:
                if term != '\n':
                    lexicon[category][term] = weight
    return lexicon
