박은주

Clearance

......@@ -27,7 +27,7 @@ def GetResult(annotations):
def analyze(movie_review_filename):
client = language_v1.LanguageServiceClient()
try:
with open(movie_review_filename, "r", encoding='utf-8-sig') as review_file:
# Instantiates a plain text document.
content = review_file.read()
......@@ -35,6 +35,8 @@ def analyze(movie_review_filename):
annotations = client.analyze_sentiment(request={'document': document})
return GetResult(annotations)
except:
return 0, 0, 0, 0
def StartSentimentAnalysis():
return analyze("data.txt")
\ No newline at end of file
......