speech_recognition icon indicating copy to clipboard operation
speech_recognition copied to clipboard

[Android&iOS] Support language problem fix

Open UnRyongPark opened this issue 5 years ago • 9 comments

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?

UnRyongPark avatar Apr 02 '19 09:04 UnRyongPark

+@ 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)

UnRyongPark avatar Apr 02 '19 15:04 UnRyongPark

@rxlabz Feedback please. :) I am not good at English, so I don't know if I explained it correctly.

UnRyongPark avatar Apr 02 '19 15:04 UnRyongPark

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 avatar May 06 '19 06:05 vintage

@vintage Hello :D Thanks your comment!

that is two problem.

  1. 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.

  2. 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)

UnRyongPark avatar May 06 '19 06:05 UnRyongPark

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 avatar May 07 '19 05:05 vintage

@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.

UnRyongPark avatar May 08 '19 01:05 UnRyongPark

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.

ngoan98tv avatar Oct 10 '19 16:10 ngoan98tv

@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.

UnRyongPark avatar Oct 15 '19 07:10 UnRyongPark

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.

kevincmanning avatar Nov 06 '19 06:11 kevincmanning