Commit 95014d6e authored by Alberto Pascual's avatar Alberto Pascual
Browse files

senpy endpoint added

parent acbc7b7e
......@@ -75,16 +75,16 @@ class AnalysisTask(luigi.Task):
print(self.url)
print(self.num)
cnn = retrieveCnnNews(self.url, 5, filePath)
nyt = retrieveNytimesNews(self.url, 5, filePath)
alj = retrieveAlJazeeraNews(self.url, 5, filePath)
cnn = retrieveCnnNews(self.url, 20, filePath)
nyt = retrieveNytimesNews(self.url, 20, filePath)
alj = retrieveAlJazeeraNews(self.url, 20, filePath)
"""
#print("aljazeera")
#print(alj)
"""
dabiqarticles = json.load(open('dabiqarticles.json'))
rumiyaharticles = json.load(open('rumiyaharticles.json'))
tweets = retrieve_tweets("islamic state", filePath, 5)
tweets = retrieve_tweets("islamic state", filePath, 20)
with self.output().open('w') as output:
......
......@@ -45,9 +45,9 @@ def semanticAnalysis(i):
for k in range(0,number_of_requests+1):
if i_len - int(REQUEST_LONG*(k+1)) > 0:
r = requests.post('http://senpy:5000/api/', data={'algo':'sentiment140', 'apiKey':API_KEY_MEANING_CLOUD, 'i':i["http://schema.org/articleBody"][0]["@value"][REQUEST_LONG*k:REQUEST_LONG*k+REQUEST_LONG]})
r = requests.post('http://senpy.cluster.gsi.dit.upm.es//api/', data={'algo':'sentiment-vader', 'apiKey':API_KEY_MEANING_CLOUD, 'i':i["http://schema.org/articleBody"][0]["@value"][REQUEST_LONG*k:REQUEST_LONG*k+REQUEST_LONG]})
else:
r = requests.post('http://senpy:5000/api/', data={'algo':'sentiment140', 'apiKey':API_KEY_MEANING_CLOUD, 'i':i["http://schema.org/articleBody"][0]["@value"][REQUEST_LONG*k:-1]})
r = requests.post('http://senpy.cluster.gsi.dit.upm.es/api/', data={'algo':'sentiment-vader', 'apiKey':API_KEY_MEANING_CLOUD, 'i':i["http://schema.org/articleBody"][0]["@value"][REQUEST_LONG*k:-1]})
time.sleep(1)
r = r.json()
......@@ -190,9 +190,9 @@ def myAnalysis(i):
for k in range(0,number_of_requests+1):
if i_len - int(REQUEST_LONG*(k+1)) > 0:
r = requests.post('http://senpy:5000/api/', data={'algo':'sentiment140', 'apiKey':API_KEY_MEANING_CLOUD, 'i':i["schema:articleBody"][REQUEST_LONG*k:REQUEST_LONG*k+REQUEST_LONG]})
r = requests.post('http://senpy.cluster.gsi.dit.upm.es/api/', data={'algo':'sentiment-vader', 'apiKey':API_KEY_MEANING_CLOUD, 'i':i["schema:articleBody"][REQUEST_LONG*k:REQUEST_LONG*k+REQUEST_LONG]})
else:
r = requests.post('http://senpy:5000/api/', data={'algo':'sentiment140', 'apiKey':API_KEY_MEANING_CLOUD, 'i':i["schema:articleBody"][REQUEST_LONG*k:-1]})
r = requests.post('http://senpy.cluster.gsi.dit.upm.es/api/', data={'algo':'sentiment-vader', 'apiKey':API_KEY_MEANING_CLOUD, 'i':i["schema:articleBody"][REQUEST_LONG*k:-1]})
time.sleep(1)
r = r.json()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment