Repository navigation
🔍 Examples of Generated Samples for Code Review [DO NOT MERGE] - #4264
beccasaurus wants to merge 2 commits into
Conversation
|
/cc @googleapis/samplegen |
| # For list of supported languages: | ||
| # https://cloud.google.com/natural-language/docs/languages | ||
| language = "en" | ||
| document = { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| # Available values: NONE, UTF8, UTF16, UTF32 | ||
| encoding_type = :UTF8 | ||
|
|
||
| response = language_client.analyze_sentiment(document, encoding_type: encoding_type) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| text_content = "I am so happy and joyful." | ||
|
|
||
| ARGV.options do |opts| | ||
| opts.on("--text_content=val") { |val| text_content = val } |
There was a problem hiding this comment.
Can we translate lower_snake_case to kebab-case for option names?
| opts.parse! | ||
| end | ||
|
|
||
|
|
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
|
||
| # Analyzing Sentiment in a String | ||
| # | ||
| # @param text_content {String} The text content to analyze |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| response.results.each do |result| | ||
| # First alternative is the most probable result | ||
| alternative = result.alternatives[0] | ||
| puts "Transcript: #{alternative.transcript}" |
There was a problem hiding this comment.
wow, this is impressive. I can't believe it's not manual.
| # description: Analyzing Sentiment in a String | ||
| # bundle exec ruby samples/v1/language_sentiment_text.rb [--text_content "I am so happy and joyful."] | ||
|
|
||
| require "google/cloud/language" |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
Changes incoming! All kinds of changes in response to feedback.
Overall, lots of vertical padding added for aesthetic goodness. Generated from: https://github.com/beccasaurus/gapic-generator/compare/ruby-standalone-syntax-updates GAPIC Generator PR: |
|
Closing per recent conversation ~ while these updates look good and are close to the desired state, the generation of these files is planned to move to the µgenerator. |
This Pull Request contains two code samples which were generated using the GAPIC generator:
language_sentiment_text) (config YAML)speech_transcribe_async) (config YAML)These code samples demonstrate a few features of the code sample generator:
You can find the existing, published hand-written versions of these code samples here:
For Ruby, existing hand-written code samples can be found in the
ruby-docs-samplesrepository.The goal is for these generated code samples to meet the expectations of hand-written samples.
Language experts, please TAL! 🧐
/cc @dazuma @frankyn @TheRoyalTnetennba @dizcology @blowmage
This is one of seven Pull Requests being sent for code review of rendered generated sample syntax.