Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 59e030f

Browse files
authored
Create Analyze Sentiment with Natural Language API: Challenge Lab
1 parent d9636b3 commit 59e030f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
cat > analyze-request.json <<EOF
2+
{
3+
"document":{
4+
"type":"PLAIN_TEXT",
5+
"content": "Google, headquartered in Mountain View, unveiled the new Android phone at the Consumer Electronic Show. Sundar Pichai said in his keynote that users love their new Android phones."
6+
},
7+
"encodingType": "UTF8"
8+
}
9+
EOF
10+
11+
curl -s -H "Content-Type: application/json" \
12+
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
13+
"https://language.googleapis.com/v1/documents:analyzeSyntax" \
14+
-d @analyze-request.json > analyze-response.txt
15+
16+
17+
18+
19+
20+
cat > multi-nl-request.json <<EOF
21+
{
22+
"document": {
23+
"type": "PLAIN_TEXT",
24+
"content": "Le bureau japonais de Google est situé à Roppongi Hills, Tokyo.",
25+
"language": "fr"
26+
}
27+
}
28+
29+
EOF
30+
31+
32+
curl -s -H "Content-Type: application/json" \
33+
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
34+
"https://language.googleapis.com/v1/documents:analyzeEntities" \
35+
-d @multi-nl-request.json > multi-response.txt

0 commit comments

Comments
 (0)