8000 added encoding type analyze sentiment · jasonmorton/python-docs-samples@4ccdce7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ccdce7

Browse files
committed
added encoding type analyze sentiment
1 parent 983a5aa commit 4ccdce7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

language/api/analyze.py

Lines 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