Uh oh!
There was an error while loading. Please reload this page.
Added setEnableWordTimeOffsets(true) to Async Recognize for a File - #781
Added setEnableWordTimeOffsets(true) to Async Recognize for a File#781dlaqab wants to merge 5 commits into
Conversation
Added setEnableWordTimeOffsets(false) to Sync samples and quick start
googlebot
commented
Aug 1, 2017
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
dlaqab
commented
Aug 1, 2017
I am covered by my current employer (Google) |
| .setEncoding(AudioEncoding.FLAC) | ||
| .setLanguageCode("en-US") | ||
| .setSampleRateHertz(16000) | ||
| .setEnableWordTimeOffsets(false) |
| .setEncoding(AudioEncoding.LINEAR16) | ||
| .setLanguageCode("en-US") | ||
| .setSampleRateHertz(16000) | ||
| .setEnableWordTimeOffsets(false) |
| List<SpeechRecognitionAlternative> alternatives = result.getAlternativesList(); | ||
| for (SpeechRecognitionAlternative alternative: alternatives) { | ||
| System.out.printf("Transcription: %s%n", alternative.getTranscript()); | ||
| for (WordInfo wordInfo: alternative.getWordsList()) { |
There was a problem hiding this comment.
Done. I added the test. I also fixed the test failure in AsyncRecognizeGcs test, so all the tests should pass now
| for (WordInfo wordInfo: alternative.getWordsList()) { | ||
| System.out.println(wordInfo.getWord()); | ||
| System.out.printf("\t%s ns - %s ns\n", | ||
| wordInfo.getStartTime().getNanos(), wordInfo.getEndTime().getNanos()); |
There was a problem hiding this comment.
You're missing seconds, this just shows the nanoseconds for portions of the response.
There was a problem hiding this comment.
Please update the other async sample to correctly show the seconds and nanos calculated to second fractions.
There was a problem hiding this comment.
your original code did not have seconds, and I did not change the "pretty print" to show seconds.
| .setEncoding(AudioEncoding.LINEAR16) | ||
| .setSampleRateHertz(16000) | ||
| .setLanguageCode("en-US") | ||
| .setEnableWordTimeOffsets(false) |
There was a problem hiding this comment.
Isn't this superfluous as false is the default?
There was a problem hiding this comment.
I'm pretty sure we don't want to set an optional parameter to its default value in the quickstart example. Thoughts?
Fixed the tests for WordTimeOffsets
googlebot
commented
Aug 2, 2017
CLAs look good, thanks! |
| List<SpeechRecognitionAlternative> alternatives = result.getAlternativesList(); | ||
| for (SpeechRecognitionAlternative alternative: alternatives) { | ||
| System.out.printf("Transcription: %s%n", alternative.getTranscript()); | ||
| System.out.printf("Transcription: %s\n",alternative.getTranscript()); |
There was a problem hiding this comment.
This should be:
System.out.printf("\t%s.%s sec - %s.%s sec\n",
wordInfo.getStartTime().getSeconds(),
wordInfo.getStartTime().getNanos() / 100000000,
wordInfo.getEndTime().getSeconds(),
wordInfo.getEndTime().getNanos() / 100000000);
}
There was a problem hiding this comment.
This line shows the all up transcript - lines bellow it are iterating through the words and displaying the start and end time stamps
| Recognize.asyncRecognizeGcs(gcsPath); | ||
| String got = bout.toString(); | ||
| assertThat(got).contains("\t0.0 sec -"); | ||
| assertThat(got).contains("\t0 ns"); |
There was a problem hiding this comment.
Revert this change when you correct the print output in asyncRecognizeFile
gguuss
commented
Aug 2, 2017
@dlaqab Please update your branch to match master, change your new code to match the updated start seconds / end seconds code as: Revert your change in RecognizeIT to test for actual seconds / fractions of a second. |
@lesv /FYI - Looks like the Circle tests are not running because this is on a personal fork of the repo. When I run the tests locally, the following is my output:
Checkstyle shows:
So mostly LGTM, I'm just a little concerned about setting the optional parameter to its default value in the Quickstart still. |
lesv
commented
Aug 3, 2017
@gguuss I'll try to fix that tomorrow. |
gguuss
left a comment
There was a problem hiding this comment.
I feel we may want to at some point remove the .setEnableWordTimeOffsets(false) calls but reluctantly approving for today.
googlebot
commented
Aug 3, 2017
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
gguuss
commented
Aug 3, 2017
I signed it! |
gguuss
left a comment
There was a problem hiding this comment.
Will make change separately to match other samples.
beccasaurus
commented
Aug 4, 2017
This can be closed. |
dlaqab
commented
Aug 4, 2017
why? I am not sure why this needs to be closed |
beccasaurus
commented
Aug 4, 2017
|
beccasaurus
commented
Aug 4, 2017
The setEnableWordTimeOffsets() call in these samples is extraneous to the task these samples are intended to demonstrate. Closing. |
beccasaurus
commented
Aug 4, 2017
Note: samples which demonstrate Enable Word Time Offsets were added to java-docs-samples in #787 |
Added setEnableWordTimeOffsets(true) to Async Recognize for a File
Added setEnableWordTimeOffsets(false) to Sync samples and quick start