Ejemplo n.º 1
0
    def AspectBasedSentiment(self, options):
        options = self._normalizeInput(options)
        if 'text' not in options and 'url' not in options:
            raise MissingParameterError('You must either provide url or text')

        if 'domain' not in options:
            raise MissingParameterError('You must specify the domain')

        response = self._executeRequest('absa/' + options.pop('domain'),
                                        options)

        return response
Ejemplo n.º 2
0
    def ClassifyByTaxonomy(self, options):
        options = self._normalizeInput(options)
        if 'text' not in options and 'url' not in options:
            raise MissingParameterError('You must either provide url or text')

        if 'taxonomy' not in options:
            raise MissingParameterError('You must specify the taxonomy')

        response = self._executeRequest('classify/' + options.pop('taxonomy'),
                                        options)

        return response
Ejemplo n.º 3
0
    def Combined(self, options):
        options = self._normalizeInput(options)
        if 'text' not in options and 'url' not in options:
            raise MissingParameterError('You must either provide url or text')

        response = self._executeRequest('combined', options)

        return response
Ejemplo n.º 4
0
    def ImageTags(self, options):
        options = self._normalizeInput(options)
        if 'url' not in options:
            raise MissingParameterError('You must provide a url')

        response = self._executeRequest('image-tags', options)

        return response
Ejemplo n.º 5
0
    def Extract(self, options):
        if isinstance(options, basestring):
            tmp = {}
            tmp['url'] = options
            options = tmp
        if 'url' not in options:
            raise MissingParameterError('You must provide a url')

        response = self._executeRequest('extract', options)

        return response
Ejemplo n.º 6
0
    def Related(self, options):
        if isinstance(options, basestring):
            tmp = {}
            tmp['phrase'] = options
            options = tmp
        if 'phrase' not in options:
            raise MissingParameterError('You must provide a phrase')

        response = self._executeRequest('related', options)

        return response