-
Notifications
You must be signed in to change notification settings - Fork 1
/
analyzer.html
33 lines (32 loc) · 1.23 KB
/
analyzer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
<head>
<!-- <script src="./build.js"></script> -->
<script src="https://apis.google.com/js/api.js"></script>
<script>
function start() {
// 2. Initialize the JavaScript client library.
gapi.client.init({
'apiKey': 'AIzaSyCwgHoouSj6djXwYAsu7FKUra8140oqDNA',
// Your API key will be automatically added to the Discovery Document URLs.
'discoveryDocs': ['https://language.googleapis.com/$discovery/rest?version=v1']
}).then(function() {
// 3. Initialize and make the API request.
return gapi.client.language.documents.analyzeSentiment({
'document': {
'type': 'PLAIN_TEXT',
'content': 'I am so happy'
}});
}).then(function(response) {
console.log(response.result);
}, function(reason) {
console.log('Error: ' + reason.result.error.message);
});
};
// 1. Load the JavaScript client library.
gapi.load('client', start);
</script>
</head>
<body>
</body>
</html>