Reputation: 81
I am using Google Speech API on Java.
I can find language configuration something like languagecode
in Python version, but I can't find that in Java version.
I can find documents changing the language for Python, but I can't find for Java. And, I can't find something like languagecode
or en_US
in Java source.
How to change the language of Google Speech API on Java?
Upvotes: 2
Views: 479
Reputation: 1350
It's a field of the RecognitionConfig object, so you should be able to set it here.
I don't have access to the Java code at the moment, but it's probably something like this:
RecognitionConfig config =
RecognitionConfig.newBuilder()
.setEncoding(AudioEncoding.LINEAR16)
.setSampleRate(samplingRate)
.setLanguageCode("en-US")
.build();
Of course, you can omit the encoding and sample rate if you're using the default values.
This field is part of the API so it may be defined in a protobuf file rather than in Java source files.
Upvotes: 1