OxbridgeEconomics
commited on
Commit
·
52bf3e0
1
Parent(s):
7b6960f
commit
Browse files
glue.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""Trigger Parquet Snapshot Glue job"""
|
2 |
+
import os
|
3 |
+
import boto3
|
4 |
+
|
5 |
+
AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']
|
6 |
+
AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY']
|
7 |
+
|
8 |
+
def get_client_connection():
|
9 |
+
"""Get dynamoDB connection"""
|
10 |
+
return boto3.client(
|
11 |
+
service_name='glue',
|
12 |
+
region_name='us-east-1',
|
13 |
+
aws_access_key_id=AWS_ACCESS_KEY_ID,
|
14 |
+
aws_secret_access_key=AWS_SECRET_ACCESS_KEY
|
15 |
+
)
|
16 |
+
|
17 |
+
glue = get_client_connection()
|
18 |
+
response = glue.start_job_run(
|
19 |
+
JobName='Article Snapshot China'
|
20 |
+
)
|
21 |
+
print(response)
|
utils.py
CHANGED
@@ -137,7 +137,7 @@ def sentiment_computation(content):
|
|
137 |
}
|
138 |
sentiment_score = 0
|
139 |
maximum_value = 0
|
140 |
-
raw_sentiment = analyzer(content[:
|
141 |
sentiment_label = None
|
142 |
for sentiment_dict in raw_sentiment:
|
143 |
value = sentiment_dict["score"]
|
|
|
137 |
}
|
138 |
sentiment_score = 0
|
139 |
maximum_value = 0
|
140 |
+
raw_sentiment = analyzer(content[:511], top_k=None)
|
141 |
sentiment_label = None
|
142 |
for sentiment_dict in raw_sentiment:
|
143 |
value = sentiment_dict["score"]
|