コード例 #1
0
ファイル: basic_plugin.py プロジェクト: gsi-upm/senpy
 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]
コード例 #3
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
コード例 #4
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
コード例 #5
0
ファイル: configurable_plugin.py プロジェクト: gsi-upm/senpy
    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
ファイル: parameterized_plugin.py プロジェクト: gsi-upm/senpy
    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
ファイル: basic_plugin.py プロジェクト: zhanglipku/senpy
 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'])