示例#1
0
 def predict_one(self, features, **kwargs):
     output = basic.get_polarity(features[0])
     if output == 'pos':
         return [1, 0, 0]
     if output == 'neu':
         return [0, 1, 0]
     return [0, 0, 1]
示例#2
0
 def predict_one(self, features, **kwargs):
     output = basic.get_polarity(features[0])
     if output == 'pos':
         return [1, 0, 0]
     if output == 'neg':
         return [0, 0, 1]
     return [0, 1, 0]
    def analyse_entry(self, entry, activity):
        polarity = basic.get_polarity(entry.text)

        polarity = self.mappings.get(polarity, self.mappings['default'])

        s = models.Sentiment(marl__hasPolarity=polarity)
        s.prov(activity)
        entry.sentiments.append(s)
        yield entry
    def analyse_entry(self, entry, activity):
        polarity = basic.get_polarity(entry.text)

        polarity = self.mappings.get(polarity, self.mappings['default'])

        s = models.Sentiment(marl__hasPolarity=polarity)
        s.prov(activity)
        entry.sentiments.append(s)
        yield entry
示例#5
0
    def analyse_entry(self, entry, *args, **kwargs):
        polarity = basic.get_polarity(entry.text, self.dictionaries)
        if polarity in self.mappings:
            polarity = self.mappings[polarity]

        s = models.Sentiment(marl__hasPolarity=polarity)
        s.prov(self)
        entry.sentiments.append(s)
        yield entry
示例#6
0
    def analyse_entry(self, entry, *args, **kwargs):
        polarity = basic.get_polarity(entry.text, self.dictionaries)
        if polarity in self.mappings:
            polarity = self.mappings[polarity]

        s = models.Sentiment(marl__hasPolarity=polarity)
        s.prov(self)
        entry.sentiments.append(s)
        yield entry
示例#7
0
    def analyse_entry(self, entry, params):
        positive_words = params['positive-words'].split(',')
        negative_words = params['negative-words'].split(',')
        dictionary = {
            'marl:Positive': positive_words,
            'marl:Negative': negative_words,
        }
        polarity = basic.get_polarity(entry.text, [dictionary])

        s = models.Sentiment(marl__hasPolarity=polarity)
        s.prov(self)
        entry.sentiments.append(s)
        yield entry
示例#8
0
    def analyse_entry(self, entry, activity):
        params = activity.params
        positive_words = params['positive-words'].split(',')
        negative_words = params['negative-words'].split(',')
        dictionary = {
            'marl:Positive': positive_words,
            'marl:Negative': negative_words,
        }
        polarity = basic.get_polarity(entry.text, [dictionary])

        s = models.Sentiment(marl__hasPolarity=polarity)
        s.prov(activity)
        entry.sentiments.append(s)
        yield entry
示例#9
0
 def predict_one(self, input):
     return basic.get_polarity(input)
示例#10
0
 def predict_one(self, input):
     output = basic.get_polarity(input)
     return self.mappings.get(output, self.mappings['default'])