Skip to content

Commit ac74a33

Browse files
author
remi Taylor
committed
Add usage to language sample README and rename sample file
1 parent 33e42a6 commit ac74a33

3 files changed

Lines changed: 40 additions & 2 deletions

File tree

language/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,41 @@ recognition, and syntax analysis. This API is part of the larger Cloud Machine
88
Learning API.
99

1010
[language_docs]: https://cloud.google.com/natural-language/docs/
11+
12+
## Run sample
13+
14+
To run the sample, first install dependencies:
15+
16+
bundle install
17+
18+
Run the sample:
19+
20+
export GOOGLE_CLOUD_PROJECT="Your Google Cloud project ID"
21+
22+
bundle exec ruby language_samples.rb
23+
24+
Usage:
25+
26+
Usage: ruby language_samples.rb <text-to-analyze>
27+
28+
Example:
29+
30+
bundle exec ruby language_samples.rb "Alice and Bob are happy people."
31+
32+
Sentiment:
33+
1.0 (0.699999988079071)
34+
35+
Entries:
36+
Entity Alice PERSON
37+
Entity Bob PERSON
38+
39+
Syntax:
40+
Sentences: 1
41+
Tokens: 7
42+
NOUN Alice
43+
CONJ and
44+
NOUN Bob
45+
VERB are
46+
ADJ happy
47+
NOUN people
48+
PUNCT .
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,6 @@ def syntax_from_cloud_storage_file project_id:, storage_path:
133133
puts "Syntax:"
134134
syntax_from_text project_id: project_id, text_content: ARGV.first
135135
else
136-
puts "Usage: ruby samples.rb <test-to-analyze>"
136+
puts "Usage: ruby language_samples.rb <text-to-analyze>"
137137
end
138138
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require_relative "../samples"
1+
require_relative "../language_samples"
22
require "rspec"
33
require "tempfile"
44
require "google/cloud"

0 commit comments

Comments
 (0)