Beispiel #1
0
 def negating_words(self):
     """
     :return: set of string
     """
     if self._negating_words is None:
         self._negating_words = set(iterate_file(self.path(NEGATING_WORDS)))
     return self._negating_words
Beispiel #2
0
 def question_words(self):
     """
     :return: set of string
     """
     if self._question_words is None:
         self._question_words = set(iterate_file(self.path(QUESTION_WORDS)))
     return self._question_words
Beispiel #3
0
 def slang_lookup_table(self):
     """
     :return: dict<string, string>
     """
     if self._slang_lookup_table is None:
         self._slang_lookup_table = dict()
         for line in iterate_file(self.path(SLANG_LOOK_TABLE)):
             word, long_term = line.split('\t')
             self._slang_lookup_table[word] = long_term.replace('\xa0', '')
     return self._slang_lookup_table
Beispiel #4
0
 def emoticon_lookup_table(self):
     """
     :return: dict<string, float>
     """
     if self._emoticon_lookup_table is None:
         self._emoticon_lookup_table = dict()
         for line in iterate_file(self.path(EMOTICON_LOOKUP_TABLE)):
             emoticon, value = line.split('\t')[:2]
             self._emoticon_lookup_table[emoticon] = int(value)
     return self._emoticon_lookup_table
Beispiel #5
0
 def idiom_lookup_table(self):
     """
     :return: dict(string, float)
     """
     if self._idiom_lookup_table is None:
         self._idiom_lookup_table = dict()
         for line in iterate_file(self.path(IDIOM_LOOKUP_TABLE)):
             parts = line.split('\t')
             word, value = parts[:2]
             self._idiom_lookup_table[word] = int(value)
     return self._idiom_lookup_table
Beispiel #6
0
 def boosters(self):
     """
     :return: dict(string, float)
     """
     if self._boosters is None:
         self._boosters = dict()
         for line in iterate_file(self.path(BOOSTER_WORD)):
             parts = line.split('\t')
             word, value = parts[:2]
             self._boosters[word] = int(value)
     return self._boosters
Beispiel #7
0
 def emotion_lookup_table(self):
     """
     :return: dict<string pattern, float>
     """
     if self._emotion_lookup_table is None:
         self._emotion_lookup_table = dict()
         for line in iterate_file(self.path(EMOTION_LOOKUP_TABLE)):
             parts = line.split('\t')
             word, value = parts[:2]
             value = int(value)
             if word in self._emotion_lookup_table and self._emotion_lookup_table[word] != value:
                 raise Exception('crush {}'.format(word))
             self._emotion_lookup_table[word] = value
     return self._emotion_lookup_table
Beispiel #8
0
 def words(self):
     if self._words is None:
         self._words = set(iterate_file(self.path(ENGLISH_WORD)))
     return self._words