Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4ccdce7

Browse filesBrowse files
committed
added encoding type analyze sentiment
1 parent 983a5aa commit 4ccdce7
Copy full SHA for 4ccdce7

File tree

Expand file treeCollapse file tree

1 file changed

+5
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-4
lines changed

‎language/api/analyze.py

Copy file name to clipboardExpand all lines: language/api/analyze.py
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def analyze_entities(text, encoding='UTF32'):
5555
'type': 'PLAIN_TEXT',
5656
'content': text,
5757
},
58-
'encodingType': encoding,
58+
'encoding_type': encoding,
5959
}
6060

6161
service = get_service()
@@ -66,12 +66,13 @@ def analyze_entities(text, encoding='UTF32'):
6666
return response
6767

6868

69-
def analyze_sentiment(text):
69+
def analyze_sentiment(text, encoding='UTF32'):
7070
body = {
7171
'document': {
7272
'type': 'PLAIN_TEXT',
7373
'content': text,
74-
}
74+
},
75+
'encoding_type': encoding
7576
}
7677

7778
service = get_service()
@@ -112,7 +113,7 @@ def analyze_syntax(text, encoding='UTF32'):
112113
if args.command == 'entities':
113114
result = analyze_entities(args.text, get_native_encoding_type())
114115
elif args.command == 'sentiment':
115-
result = analyze_sentiment(args.text)
116+
result = analyze_sentiment(args.text, get_native_encoding_type())
116117
elif args.command == 'syntax':
117118
result = analyze_syntax(args.text, get_native_encoding_type())
118119

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.