Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providing pronunciation hints #917

Closed
alanb2718 opened this issue Jan 23, 2024 · 11 comments
Closed

providing pronunciation hints #917

alanb2718 opened this issue Jan 23, 2024 · 11 comments

Comments

@alanb2718
Copy link
Collaborator

It would be useful to be able to give yap a hint as to how to pronounce the name of a town when it reads meeting search results.

For example, if I search for meetings in Yakima, Washington, yap recognizes the town name, but when reading the meetings back, it pronounces it as 'UkEEma'.

@dgershman
Copy link
Collaborator

I'm pretty sure this would also affect Geocoding responses. For example if you enter a zip code or say a city or state, it reads back the location.

@alanb2718
Copy link
Collaborator Author

Yes, we would want incorrect pronunciations to be fixed for that as well, if possible.

@dgershman
Copy link
Collaborator

This will be in the next yap 4.3.0 beta

@dgershman
Copy link
Collaborator

yap 4.3.0 beta 8 was released.

@alanb2718
Copy link
Collaborator Author

Alas I'm not having any luck getting pronunciation hints to work. The example in the documentation is for Yakima:

static $pronunciations = [[
    "source"=>"Yakima",
    "target"=>"UkEEma"
]];

But UkEEma is what Twilio/yap currently says, and isn't correct. It should be YAKima (/ˈjækɪmɑː/). I tried various phonetic spellings (YAKima, Yaakima, etc), but none of them changed what was spoken. Then I tried just "Yak" as the target, to see if it was getting picked up at all, and Twilio/yap is still saying UkEEma.

Should I be doing something different?

@dgershman
Copy link
Collaborator

Is this still not working?

@dgershman
Copy link
Collaborator

#943

@alanb2718
Copy link
Collaborator Author

alanb2718 commented Feb 29, 2024

Looks like there is a bug in the pronunciationReplacement function -- it just works on the first replacement source/target pair. Need to go through all of the replacements.

I may also have had a caching problem, but at least now it's working for the first pair.

@dgershman
Copy link
Collaborator

Interesting, because str_replace() is supposed to replace all occurrences. Will write another test for this and see what's up.

@alanb2718
Copy link
Collaborator Author

The "all occurrences" part is ok. Here's the function:

    private function pronunciationReplacement($subject): string
    {
        foreach ($this->settings->get("pronunciations") as $item) {
            return str_replace($item['source'], $item['target'], $subject);
        }

        return $subject;
    }
}

So we iterate through the pronunciations, and return after processing the first item. So you'd fix all the occurrences of "Sequim", but not "Yakima", for those two pronunciation hints.

@dgershman
Copy link
Collaborator

gotcha, i understand now what you are saying!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants