Skip to content

Commit 23b3862

Browse files
gguusschingor13
authored andcommitted
samples: Fixes seconds reported in word time offsets and enables maven checks
1 parent 027d0e2 commit 23b3862

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

speech/snippets/src/main/java/com/example/speech/Recognize.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,11 @@ public static void asyncRecognizeGcs(String gcsUri) throws Exception, IOExceptio
229229
System.out.printf("Transcription: %s\n",alternative.getTranscript());
230230
for (WordInfo wordInfo: alternative.getWordsList()) {
231231
System.out.println(wordInfo.getWord());
232-
System.out.printf("\t%s ns - %s ns\n",
233-
wordInfo.getStartTime().getNanos(), wordInfo.getEndTime().getNanos());
232+
System.out.printf("\t%s.%s sec - %s.%s sec\n",
233+
wordInfo.getStartTime().getSeconds(),
234+
wordInfo.getStartTime().getNanos() / 100000000,
235+
wordInfo.getEndTime().getSeconds(),
236+
wordInfo.getEndTime().getNanos() / 100000000);
234237
}
235238
}
236239
}

0 commit comments

Comments
 (0)