Skip to content

BUG] [IOS] OnRecognitionTextUpdated method returns incorrect words #2684

@spasham8234

Description

@spasham8234

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

current behaviour

OnRecognitionTextUpdated method returns incorrect words. For Eg : Fertilizers return as Ferets

if we take fertilizers -> its recognizing as Ferets -> Fertile -> Fertilizer -> Fertilzers. In InternalStartListeningAsync method there is a for loop which gives the result and its not iterating and reports the wrong results.

Expected Behavior

expected behaviour

OnRecognitionTextUpdated method should returns correct words.

Steps To Reproduce

Steps to reproduce

  1. implement speech to text
  2. say something like "Fertilizers" and have a breakpoint at OnRecognitionTextUpdated and check whats the result we are getting

Link to public reproduction project repository

https://github.com/CommunityToolkit/Maui/blob/main/src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.ios.cs

Environment

- .NET MAUI CommunityToolkit:
- OS:
- .NET MAUI:
ENV

- .NET MAUI CommunityToolkit: 9.1.1
- OS: IOS 18.4.1
- .NET MAUI: 8.0.15

Anything to Add

                    if (result.Final)
                    {
                        currentIndex = 0;
                        StopRecording();
                        taskResult.TrySetResult(result.BestTranscription.FormattedString);
                    }
                    else
                    {
                        float confidence = 0f;
                        float duration = 0f;
                        for (var i = 0; i < result.BestTranscription.Segments.Length; i++)
                        {
                            var s = result.BestTranscription.Segments[i].Substring;
                            if (result.BestTranscription.Segments[i]?.Confidence > confidence && result.BestTranscription.Segments[i]?.Duration > duration)
                            {
                                recognitionResult?.Report(s);
                            }
                        }
                    }
tried to create a separate handler and done this workaround. kindly suggest any fix

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions