@@ -39,7 +39,7 @@ async function analyzeSentimentOfText(text) {
39
39
const [ result ] = await client . analyzeSentiment ( { document} ) ;
40
40
41
41
const sentiment = result . documentSentiment ;
42
- console . log ( ` Document sentiment:` ) ;
42
+ console . log ( ' Document sentiment:' ) ;
43
43
console . log ( ` Score: ${ sentiment . score } ` ) ;
44
44
console . log ( ` Magnitude: ${ sentiment . magnitude } ` ) ;
45
45
@@ -77,7 +77,7 @@ async function analyzeSentimentInFile(bucketName, fileName) {
77
77
const [ result ] = await client . analyzeSentiment ( { document} ) ;
78
78
79
79
const sentiment = result . documentSentiment ;
80
- console . log ( ` Document sentiment:` ) ;
80
+ console . log ( ' Document sentiment:' ) ;
81
81
console . log ( ` Score: ${ sentiment . score } ` ) ;
82
82
console . log ( ` Magnitude: ${ sentiment . magnitude } ` ) ;
83
83
@@ -189,7 +189,7 @@ async function analyzeSyntaxOfText(text) {
189
189
console . log ( 'Tokens:' ) ;
190
190
syntax . tokens . forEach ( part => {
191
191
console . log ( `${ part . partOfSpeech . tag } : ${ part . text . content } ` ) ;
192
- console . log ( ` Morphology:` , part . partOfSpeech ) ;
192
+ console . log ( ' Morphology:' , part . partOfSpeech ) ;
193
193
} ) ;
194
194
// [END language_syntax_text]
195
195
}
@@ -223,7 +223,7 @@ async function analyzeSyntaxInFile(bucketName, fileName) {
223
223
console . log ( 'Parts of speech:' ) ;
224
224
syntax . tokens . forEach ( part => {
225
225
console . log ( `${ part . partOfSpeech . tag } : ${ part . text . content } ` ) ;
226
- console . log ( ` Morphology:` , part . partOfSpeech ) ;
226
+ console . log ( ' Morphology:' , part . partOfSpeech ) ;
227
227
} ) ;
228
228
// [END language_syntax_gcs]
229
229
}
@@ -251,7 +251,7 @@ async function analyzeEntitySentimentOfText(text) {
251
251
const [ result ] = await client . analyzeEntitySentiment ( { document} ) ;
252
252
const entities = result . entities ;
253
253
254
- console . log ( ` Entities and sentiments:` ) ;
254
+ console . log ( ' Entities and sentiments:' ) ;
255
255
entities . forEach ( entity => {
256
256
console . log ( ` Name: ${ entity . name } ` ) ;
257
257
console . log ( ` Type: ${ entity . type } ` ) ;
@@ -285,7 +285,7 @@ async function analyzeEntitySentimentInFile(bucketName, fileName) {
285
285
const [ result ] = await client . analyzeEntitySentiment ( { document} ) ;
286
286
const entities = result . entities ;
287
287
288
- console . log ( ` Entities and sentiments:` ) ;
288
+ console . log ( ' Entities and sentiments:' ) ;
289
289
entities . forEach ( entity => {
290
290
console . log ( ` Name: ${ entity . name } ` ) ;
291
291
console . log ( ` Type: ${ entity . type } ` ) ;
@@ -353,98 +353,98 @@ async function classifyTextInFile(bucketName, fileName) {
353
353
// [END language_classify_gcs]
354
354
}
355
355
356
- require ( ` yargs` )
356
+ require ( ' yargs' )
357
357
. demand ( 1 )
358
358
. command (
359
- ` sentiment-text <text>` ,
360
- ` Detects sentiment of a string.` ,
359
+ ' sentiment-text <text>' ,
360
+ ' Detects sentiment of a string.' ,
361
361
{ } ,
362
362
opts => analyzeSentimentOfText ( opts . text )
363
363
)
364
364
. 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.' ,
367
367
{ } ,
368
368
opts => analyzeSentimentInFile ( opts . bucketName , opts . fileName )
369
369
)
370
- . command ( ` entities-text <text>` , ` Detects entities in a string.` , { } , opts =>
370
+ . command ( ' entities-text <text>' , ' Detects entities in a string.' , { } , opts =>
371
371
analyzeEntitiesOfText ( opts . text )
372
372
)
373
373
. 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.' ,
376
376
{ } ,
377
377
opts => analyzeEntitiesInFile ( opts . bucketName , opts . fileName )
378
378
)
379
- . command ( ` syntax-text <text>` , ` Detects syntax of a string.` , { } , opts =>
379
+ . command ( ' syntax-text <text>' , ' Detects syntax of a string.' , { } , opts =>
380
380
analyzeSyntaxOfText ( opts . text )
381
381
)
382
382
. 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.' ,
385
385
{ } ,
386
386
opts => analyzeSyntaxInFile ( opts . bucketName , opts . fileName )
387
387
)
388
388
. 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.' ,
391
391
{ } ,
392
392
opts => analyzeEntitySentimentOfText ( opts . text )
393
393
)
394
394
. 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.' ,
397
397
{ } ,
398
398
opts => analyzeEntitySentimentInFile ( opts . bucketName , opts . fileName )
399
399
)
400
- . command ( ` classify-text <text>` , ` Classifies text of a string.` , { } , opts =>
400
+ . command ( ' classify-text <text>' , ' Classifies text of a string.' , { } , opts =>
401
401
classifyTextOfText ( opts . text )
402
402
)
403
403
. 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.' ,
406
406
{ } ,
407
407
opts => classifyTextInFile ( opts . bucketName , opts . fileName )
408
408
)
409
409
. 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."'
411
411
)
412
412
. 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'
415
415
)
416
416
. 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."'
418
418
)
419
419
. 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'
422
422
)
423
423
. 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."'
425
425
)
426
426
. 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'
429
429
)
430
430
. 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."'
432
432
)
433
433
. 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'
436
436
)
437
437
. 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."'
439
439
)
440
440
. 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'
443
443
)
444
444
. wrap ( 120 )
445
445
. recommendCommands ( )
446
446
. 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'
448
448
)
449
449
. help ( )
450
450
. strict ( ) . argv ;
0 commit comments