问题
Is is possible for the API to return the phonetics of what the sound file says? Or, is it possible to provide non-real vocabulary words?
I have a foreign language tutorial where I might be able to use this. It for examples teaches non-Latin alphabets like Cyrillic, Hebrew, Arabic, Chinese, etc...
I have a library of non-sense words to help the student learn; the reason for non-sense words vs real words is that it breaks the steps down to just two letters at a time; and at first, there aren't many real words that can be created with just those letters.
I'd like to show one of these non-sense words, record the student saying it, then verify if they said it correctly in order to give them feedback.
回答1:
It is possible to add phrases, but not using a phonetic alphabet. This, for instance, would recognise the ficticious word "Affelfaffel", provided it's pronounced as it should be according to the specified language code:
var speech = SpeechClient.Create();
string url = @"gs://your-bucket-name/your-file";
StringBuilder sb = new StringBuilder();
RecognitionConfig rc = new RecognitionConfig()
{
Encoding = RecognitionConfig.Types.AudioEncoding.Linear16,
SampleRate = 16000,
LanguageCode = LanguageCodes.English.UnitedKingdom
};
rc.SpeechContext = new SpeechContext();
rc.SpeechContext.Phrases.Add("Affelfaffel");
var longOperation = speech.AsyncRecognize(rc, RecognitionAudio.FromStorageUri(url));
longOperation = await longOperation.PollUntilCompletedAsync();
var response = longOperation.Result;
foreach (var result in response.Results)
{
foreach (var alternative in result.Alternatives)
{
sb.Append(alternative.Transcript);
}
}
来源:https://stackoverflow.com/questions/43261093/google-cloud-speech-api-capability-for-non-sense-words-or-phonetics