Skip to content

Commit

Permalink
Upgrades language samples to semi-gapic client (#435)
Browse files Browse the repository at this point in the history
* Upgrades language samples to semi-gapic client

* Adds package lock, may fix flaky test.

* Address comments

* Fix lint
  • Loading branch information
gguuss authored and sofisl committed Oct 13, 2022
1 parent 14507c9 commit 2fef101
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/google-cloud-language/samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"test": "npm run system-test"
},
"dependencies": {
"@google-cloud/language": "0.10.5",
"@google-cloud/language": "0.11.0",
"@google-cloud/storage": "1.1.1",
"yargs": "8.0.2"
},
Expand Down
16 changes: 8 additions & 8 deletions packages/google-cloud-language/samples/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
// Imports the Google Cloud client library
const Language = require('@google-cloud/language');

// Your Google Cloud Platform project ID
const projectId = 'YOUR_PROJECT_ID';

// Instantiates a client
const language = Language({
projectId: projectId
});
const language = Language();

// The text to analyze
const text = 'Hello, world!';

const document = {
'content': text,
type: 'PLAIN_TEXT'
};

// Detects the sentiment of the text
language.detectSentiment(text)
language.analyzeSentiment({'document': document})
.then((results) => {
const sentiment = results[0];
const sentiment = results[0].documentSentiment;

console.log(`Text: ${text}`);
console.log(`Sentiment score: ${sentiment.score}`);
Expand Down

0 comments on commit 2fef101

Please sign in to comment.