import os
import shlex


class Clues:
    DEFAULT_FILENAME = os.getcwd() + os.sep + 'subjectivity_clues' + os.sep + 'subjclueslen1-HLTEMNLP05.tff'

    def __init__(self, filename=DEFAULT_FILENAME):
        lines = self.read_all(filename)
        self.lexicons = self.parse_clues(lines)

    @staticmethod
    def read_all(filename):
        with open(filename, 'r') as f:
            clues = f.readlines()
        return clues

    @staticmethod
    def parse_clues(lines):
        clues = dict()
        for l in lines:
            clue = dict(token.split('=') for token in shlex.split(l))
            word = clue['word1']
            clues[word] = clue
        return clues

if __name__ == '__main__':
    c = Clues()

@@ -141,16 +141,199 @@
 5.tff'%0A%0A
+    PRIORPOLARITY = %7B%0A        'positive': 1,%0A        'negative': -1,%0A        'both': 0,%0A        'neutral': 0%0A    %7D%0A%0A    TYPE = %7B%0A        'strongsubj': 2,%0A        'weaksubj': 1%0A    %7D%0A%0A
     def 
@@ -854,16 +854,657 @@
  clues%0A%0A
+    def calculate(self, sentence):%0A        related_words = 0%0A        total_subjectivity = 0%0A        total_priorpolarity = 0%0A%0A        for w in sentence.split(' '):%0A            if w not in self.lexicons.keys():%0A                continue%0A%0A            related_words += 1%0A            total_subjectivity += self.TYPE%5Bself.lexicons%5Bw%5D%5B'type'%5D%5D%0A            total_priorpolarity += self.PRIORPOLARITY%5Bself.lexicons%5Bw%5D%5B'priorpolarity'%5D%5D%0A%0A        return %7B%0A            'sentence': sentence,%0A            'related_words': related_words,%0A            'total_subjectivity': total_subjectivity,%0A            'total_priorpolarity': total_priorpolarity%0A        %7D%0A%0A
 if __nam

Add calculation to the lexicon