Skip to content

Commit 8ec3788

Browse files
AVaksmanNimJay
authored andcommitted
feat!: drop node8 support (#405)
1 parent 28e72ef commit 8ec3788

6 files changed

+239
-239
lines changed

cloud-language/snippets/analyze.v1.js

+40-40
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async function analyzeSentimentOfText(text) {
3939
const [result] = await client.analyzeSentiment({document});
4040

4141
const sentiment = result.documentSentiment;
42-
console.log(`Document sentiment:`);
42+
console.log('Document sentiment:');
4343
console.log(` Score: ${sentiment.score}`);
4444
console.log(` Magnitude: ${sentiment.magnitude}`);
4545

@@ -77,7 +77,7 @@ async function analyzeSentimentInFile(bucketName, fileName) {
7777
const [result] = await client.analyzeSentiment({document});
7878

7979
const sentiment = result.documentSentiment;
80-
console.log(`Document sentiment:`);
80+
console.log('Document sentiment:');
8181
console.log(` Score: ${sentiment.score}`);
8282
console.log(` Magnitude: ${sentiment.magnitude}`);
8383

@@ -189,7 +189,7 @@ async function analyzeSyntaxOfText(text) {
189189
console.log('Tokens:');
190190
syntax.tokens.forEach(part => {
191191
console.log(`${part.partOfSpeech.tag}: ${part.text.content}`);
192-
console.log(`Morphology:`, part.partOfSpeech);
192+
console.log('Morphology:', part.partOfSpeech);
193193
});
194194
// [END language_syntax_text]
195195
}
@@ -223,7 +223,7 @@ async function analyzeSyntaxInFile(bucketName, fileName) {
223223
console.log('Parts of speech:');
224224
syntax.tokens.forEach(part => {
225225
console.log(`${part.partOfSpeech.tag}: ${part.text.content}`);
226-
console.log(`Morphology:`, part.partOfSpeech);
226+
console.log('Morphology:', part.partOfSpeech);
227227
});
228228
// [END language_syntax_gcs]
229229
}
@@ -251,7 +251,7 @@ async function analyzeEntitySentimentOfText(text) {
251251
const [result] = await client.analyzeEntitySentiment({document});
252252
const entities = result.entities;
253253

254-
console.log(`Entities and sentiments:`);
254+
console.log('Entities and sentiments:');
255255
entities.forEach(entity => {
256256
console.log(` Name: ${entity.name}`);
257257
console.log(` Type: ${entity.type}`);
@@ -285,7 +285,7 @@ async function analyzeEntitySentimentInFile(bucketName, fileName) {
285285
const [result] = await client.analyzeEntitySentiment({document});
286286
const entities = result.entities;
287287

288-
console.log(`Entities and sentiments:`);
288+
console.log('Entities and sentiments:');
289289
entities.forEach(entity => {
290290
console.log(` Name: ${entity.name}`);
291291
console.log(` Type: ${entity.type}`);
@@ -353,98 +353,98 @@ async function classifyTextInFile(bucketName, fileName) {
353353
// [END language_classify_gcs]
354354
}
355355

356-
require(`yargs`)
356+
require('yargs')
357357
.demand(1)
358358
.command(
359-
`sentiment-text <text>`,
360-
`Detects sentiment of a string.`,
359+
'sentiment-text <text>',
360+
'Detects sentiment of a string.',
361361
{},
362362
opts => analyzeSentimentOfText(opts.text)
363363
)
364364
.command(
365-
`sentiment-file <bucketName> <fileName>`,
366-
`Detects sentiment in a file in Google Cloud Storage.`,
365+
'sentiment-file <bucketName> <fileName>',
366+
'Detects sentiment in a file in Google Cloud Storage.',
367367
{},
368368
opts => analyzeSentimentInFile(opts.bucketName, opts.fileName)
369369
)
370-
.command(`entities-text <text>`, `Detects entities in a string.`, {}, opts =>
370+
.command('entities-text <text>', 'Detects entities in a string.', {}, opts =>
371371
analyzeEntitiesOfText(opts.text)
372372
)
373373
.command(
374-
`entities-file <bucketName> <fileName>`,
375-
`Detects entities in a file in Google Cloud Storage.`,
374+
'entities-file <bucketName> <fileName>',
375+
'Detects entities in a file in Google Cloud Storage.',
376376
{},
377377
opts => analyzeEntitiesInFile(opts.bucketName, opts.fileName)
378378
)
379-
.command(`syntax-text <text>`, `Detects syntax of a string.`, {}, opts =>
379+
.command('syntax-text <text>', 'Detects syntax of a string.', {}, opts =>
380380
analyzeSyntaxOfText(opts.text)
381381
)
382382
.command(
383-
`syntax-file <bucketName> <fileName>`,
384-
`Detects syntax in a file in Google Cloud Storage.`,
383+
'syntax-file <bucketName> <fileName>',
384+
'Detects syntax in a file in Google Cloud Storage.',
385385
{},
386386
opts => analyzeSyntaxInFile(opts.bucketName, opts.fileName)
387387
)
388388
.command(
389-
`entity-sentiment-text <text>`,
390-
`Detects sentiment of the entities in a string.`,
389+
'entity-sentiment-text <text>',
390+
'Detects sentiment of the entities in a string.',
391391
{},
392392
opts => analyzeEntitySentimentOfText(opts.text)
393393
)
394394
.command(
395-
`entity-sentiment-file <bucketName> <fileName>`,
396-
`Detects sentiment of the entities in a file in Google Cloud Storage.`,
395+
'entity-sentiment-file <bucketName> <fileName>',
396+
'Detects sentiment of the entities in a file in Google Cloud Storage.',
397397
{},
398398
opts => analyzeEntitySentimentInFile(opts.bucketName, opts.fileName)
399399
)
400-
.command(`classify-text <text>`, `Classifies text of a string.`, {}, opts =>
400+
.command('classify-text <text>', 'Classifies text of a string.', {}, opts =>
401401
classifyTextOfText(opts.text)
402402
)
403403
.command(
404-
`classify-file <bucketName> <fileName>`,
405-
`Classifies text in a file in Google Cloud Storage.`,
404+
'classify-file <bucketName> <fileName>',
405+
'Classifies text in a file in Google Cloud Storage.',
406406
{},
407407
opts => classifyTextInFile(opts.bucketName, opts.fileName)
408408
)
409409
.example(
410-
`node $0 sentiment-text "President Obama is speaking at the White House."`
410+
'node $0 sentiment-text "President Obama is speaking at the White House."'
411411
)
412412
.example(
413-
`node $0 sentiment-file my-bucket file.txt`,
414-
`Detects sentiment in gs://my-bucket/file.txt`
413+
'node $0 sentiment-file my-bucket file.txt',
414+
'Detects sentiment in gs://my-bucket/file.txt'
415415
)
416416
.example(
417-
`node $0 entities-text "President Obama is speaking at the White House."`
417+
'node $0 entities-text "President Obama is speaking at the White House."'
418418
)
419419
.example(
420-
`node $0 entities-file my-bucket file.txt`,
421-
`Detects entities in gs://my-bucket/file.txt`
420+
'node $0 entities-file my-bucket file.txt',
421+
'Detects entities in gs://my-bucket/file.txt'
422422
)
423423
.example(
424-
`node $0 syntax-text "President Obama is speaking at the White House."`
424+
'node $0 syntax-text "President Obama is speaking at the White House."'
425425
)
426426
.example(
427-
`node $0 syntax-file my-bucket file.txt`,
428-
`Detects syntax in gs://my-bucket/file.txt`
427+
'node $0 syntax-file my-bucket file.txt',
428+
'Detects syntax in gs://my-bucket/file.txt'
429429
)
430430
.example(
431-
`node $0 entity-sentiment-text "President Obama is speaking at the White House."`
431+
'node $0 entity-sentiment-text "President Obama is speaking at the White House."'
432432
)
433433
.example(
434-
`node $0 entity-sentiment-file my-bucket file.txt`,
435-
`Detects sentiment of entities in gs://my-bucket/file.txt`
434+
'node $0 entity-sentiment-file my-bucket file.txt',
435+
'Detects sentiment of entities in gs://my-bucket/file.txt'
436436
)
437437
.example(
438-
`node $0 classify-text "Android is a mobile operating system developed by Google, based on the Linux kernel and designed primarily for touchscreen mobile devices such as smartphones and tablets."`
438+
'node $0 classify-text "Android is a mobile operating system developed by Google, based on the Linux kernel and designed primarily for touchscreen mobile devices such as smartphones and tablets."'
439439
)
440440
.example(
441-
`node $0 classify-file my-bucket android_text.txt`,
442-
`Detects syntax in gs://my-bucket/android_text.txt`
441+
'node $0 classify-file my-bucket android_text.txt',
442+
'Detects syntax in gs://my-bucket/android_text.txt'
443443
)
444444
.wrap(120)
445445
.recommendCommands()
446446
.epilogue(
447-
`For more information, see https://cloud.google.com/natural-language/docs`
447+
'For more information, see https://cloud.google.com/natural-language/docs'
448448
)
449449
.help()
450450
.strict().argv;

0 commit comments

Comments
 (0)