@@ -13,73 +13,50 @@ Learning API.
1313
1414* [ Setup] ( #setup )
1515* [ Samples] ( #samples )
16- * [ analyze.js ] ( #analyze )
16+ * [ Analyze ] ( #analyze )
1717
1818## Setup
1919
20- 1 . Please follow the [ Set Up Your Project] [ quickstart ] steps in the Quickstart
21- doc to create a project and enable the Cloud Natural Language API.
22201 . Read [ Prerequisites] [ prereq ] and [ How to run a sample] [ run ] first.
23211 . Install dependencies:
2422
2523 npm install
2624
27- [ quickstart ] : https://cloud.google.com/natural-language/docs/getting-started#set_up_your_project
2825[ prereq ] : ../README.md#prerequisities
2926[ run ] : ../README.md#how-to-run-a-sample
3027
3128## Samples
3229
3330### Analyze
3431
35- View the [ source code] [ analyze_code ] .
36-
37- __ Run the sample:__
38-
39- Usage: ` node analyze <sentiment|entities|syntax> <text> `
40-
41- For example, the following command returns all entities found in the text:
42-
43- Example:
44-
45- node analyze entities "President Obama is speaking at the White House."
46-
47- {
48- "entities": [
49- {
50- "name": "Obama",
51- "type": "PERSON",
52- "metadata": {
53- "wikipedia_url": "http://en.wikipedia.org/wiki/Barack_Obama"
54- },
55- "salience": 0.84503114,
56- "mentions": [
57- {
58- "text": {
59- "content": "Obama",
60- "beginOffset": 10
61- }
62- }
63- ]
64- },
65- {
66- "name": "White House",
67- "type": "LOCATION",
68- "metadata": {
69- "wikipedia_url": "http://en.wikipedia.org/wiki/White_House"
70- },
71- "salience": 0.15496887,
72- "mentions": [
73- {
74- "text": {
75- "content": "White House",
76- "beginOffset": 35
77- }
78- }
79- ]
80- }
81- ],
82- "language": "en"
83- }
32+ View the [ documentation] [ analyze_docs ] or the [ source code] [ analyze_code ] .
8433
34+ __ Usage:__ ` node analyze --help `
35+
36+ ```
37+ Commands:
38+ sentimentFromString <text> Detect the sentiment of a block of text.
39+ sentimentFromFile <bucket> <filename> Detect the sentiment of text in a GCS file.
40+ entitiesFromString <text> Detect the entities of a block of text.
41+ entitiesFromFile <bucket> <filename> Detect the entities of text in a GCS file.
42+ syntaxFromString <text> Detect the syntax of a block of text.
43+ syntaxFromFile <bucket> <filename> Detect the syntax of text in a GCS file.
44+
45+ Options:
46+ --language, -l The language of the text. [string]
47+ --type, -t Type of text [string] [choices: "text", "html"] [default: "text"]
48+ --help Show help [boolean]
49+
50+ Examples:
51+ node analyze sentimentFromString "President Obama is speaking at the White House."
52+ node analyze sentimentFromFile my-bucket file.txt
53+ node analyze entitiesFromString "<p>President Obama is speaking at the White House.</p>" -t html
54+ node analyze entitiesFromFile my-bucket file.txt
55+ node analyze syntaxFromString "President Obama is speaking at the White House."
56+ node analyze syntaxFromFile my-bucket es_file.txt -l es
57+
58+ For more information, see https://cloud.google.com/natural-language/docs
59+ ```
60+
61+ [ analyze_docs ] : https://cloud.google.com/natural-language/docs
8562[ analyze_code ] : analyze.js
0 commit comments