speech_recognition
speech_recognition copied to clipboard
[Android&iOS] Support language problem fix
Nice to find your great plug-in. If you are not satisfied with the code that I modified, please request modification:)
I tested it on my cell phone using your plug-in and found that no input other than Korean and English was returned normally.
After debugging the code, After changing the parameter to String, it was confirmed to be working properly. (SpeechRecognitionPlugin.java:67-68)
Once you've seen it working properly in the example app, I wonder why you've added Locale. Did I use it wrong?
+@ I tested iOS version.
It was confirmed that only a few languages were hard-coded to support.
So, other than the four languages that were declared directly, i immediately created and changed them to deliver. (SwiftSpeechRecognitionPlugin.swift:175)
@rxlabz Feedback please. :) I am not good at English, so I don't know if I explained it correctly.
Hey @UnRyongPark - thanks for PR. Could you describe a bit more on what's been fixed and how to reproduce issue on current master branch? I've been using the plugin for speech recognition for Polish language and it works like a charm - no issue detected. You mentioned that only Korean and English works normally for you?
@vintage Hello :D Thanks your comment!
that is two problem.
-
android um.. this is i want feedback, I'm not a client programmer, so I do not know if I did it wrong, but the Locale setting did not work properly and I did not recognize the language I wanted.
-
ios hardcoding in speech target langs(speech_recognition/ios/Classes/SwiftSpeechRecognitionPlugin.swift, line 13~17). maybe you are try English, French, Russian, Italian, and Spanish work normally, but no sets for other languages are declared. (like korean, japanese or non-english speaking culture in general)
- added: i changed only one line(line 175, switch default: return franch => return new SFSpeechRecognizer with locale)
I didn't yet tested the speech recognition on iOS in my app - will do that probably later this month, so will back on this one a bit later on if that's a not a problem :)
As for Android to detect Polish language I've used following code:
_speech = SpeechRecognition();
_speech.setRecognitionResultHandler((String text) {
print("Recognized text is $text");
});
_speech.setRecognitionCompleteHandler((_) {
Future.delayed(Duration(seconds: 1)).then((_) {
_speech.listen(locale: 'pl_PL');
});
});
_speech.listen(locale: 'pl_PL');
And it properly detects the language and accent. Can you provide what locale did you pass to the listen
function.
@vintage oh! cool! i will try your solution. If it works, I'll remove the commit and its contents. Thank you: D
ps. A little worrisome is to split the locale code and use only two.(SpeechRecognitionPlugin.java, line 91~92) Some languages use three parameters.
Thanks for your contribution @UnRyongPark
I just test this package with Vietnamese while my device in English, by switching these two languages several times I realize this package using device language instead of the language I set in listen()
method. But @UnRyongPark fixed it.
@rxlabz, hope you can merge this PR soon to improve the package.
@vintage Sorry for the late response. I've been busy and haven't tested it yet. i will test and feedback by November.
@ngoan98tv Thanks :D I think there's a better way. I will be updating the PR further in the near future.
Any chance of this being merged soon? I want to use Japanese and there aren't many options for plugins. If this won't be merged, I'll need to do a custom build for myself soon.