Toggle navigation
Toggle navigation
This project
Loading...
Sign in
박은주
/
Todays_Issue
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박은주
2021-06-08 23:21:05 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f9a1a756414858937fec575072ee6fe58279dca6
f9a1a756
1 parent
00f0e7fc
Clearance
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
SentimentAnalyzer.py
SentimentAnalyzer.py
View file @
f9a1a75
...
...
@@ -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
...
...
Please
register
or
login
to post a comment