Closed ericrwolfe closed 11 years ago
This text was just read to me in a different language.
@erondu do u mean crutch or clutch?
Is there a way to know how accurate the guess is? Or do you think that the user should always be asked if they want the text spoken in a language that is not the current one?
Not with CFStringTokenizerCopyBestStringLanguage
.
A previous version I was playing with used NSLinguisticTagger
to manually loop through each word in the text, figure out the language for the word, and add the languages to an NSCountedSet
to figure out the top language. Doing it that way you could essentially calculate the confidence or even switch languages mid-sentence if you wanted.
But the code was quite a bit more complex and probably much slower in practice, and NSLiguisticTagger was identifying all non-roman languages as "unknown", so I opted for the simpler solution above.
In what context was the text above read in a different language? By itself it was read in English for me (albeit quickly), but the pronunciation of @erondu was kind of odd, expectedly.
Ohh NSCountedSet
that's a new one to me, awesome! The whole sentence was read in Slovak it turns out sk
hehe
Thanks for the pull request, I pulled in the first part and we independently made the same later changes so the repo contains everything from this pull request so I'm gonna close this out.
Try reading "Hi" or "Hello". It's the wrong language for me.
Yeah the language detection is not 100% accurate. I'm thinking of adding an alert to ask the user if they want the text read in the detected language or their default language.
Good point. Might make sense only to do language detection for longer pieces of text.
I wonder how many words would generate 90%+ chance of selecting the right language? I would think 20 words is a good amount to start with.
Sent from my iPhone
On 27 Sep 2013, at 18:42, Eric Wolfe notifications@github.com wrote:
Good point. Might make sense only to do language detection for longer pieces of text.
— Reply to this email directly or view it on GitHub.
Rather than a more obtrusive alert, you could have a small button appear in the UI (perhaps in a toolbar above the keyboard) showing the detected language. Tapping it would let you select among the other available voices. Also, with this button the app could always just use the default language for short (i.e. less than a few words) pieces of text.
Although all of this might be overcomplicating the app for its generally simple use case :).
What's peculiar is that "I'm British. " is read in Male, British Siri and "I'm American. " is read in a foreign language.
Sent from my iPhone
On 27 Sep 2013, at 18:42, Eric Wolfe notifications@github.com wrote:
Good point. Might make sense only to do language detection for longer pieces of text.
— Reply to this email directly or view it on GitHub.
Haha that is funny
Uses CFStringTokenizerCopyBestStringLanguage to determine the language of the text, then tries to update the voice of the AVSpeechUtterance accordingly.