AceCentre / TextAloud

iOS app. Built in Swift. Reads out text - sentence by sentence, paragraph by paragraph or word by word
https://testflight.apple.com/join/D8VRhWqr
GNU General Public License v3.0
8 stars 2 forks source link

Dropping words and highlighting off in mixed lang text #47

Closed willwade closed 1 year ago

willwade commented 1 year ago

https://user-images.githubusercontent.com/229352/223460679-4768bb85-d544-436f-9a8b-75645310cdcf.mp4

taananas commented 1 year ago

Apple doesn't have gujarati, so mixing with this language isn't possible, Apple and azure support mixing only with the languages they have

Screenshot 2023-03-07 at 11 39 44

https://user-images.githubusercontent.com/116089887/223378553-b27267f5-1c04-4e7c-bb9d-65c43dc9f4ab.mov

willwade commented 1 year ago

Are you trying to say you can only get word by word highlighting with offline voices? Or at least with languages supported by offline voices

Apple do support gujariti keyboard

taananas commented 1 year ago

yes, it is, but Apple doesn't support playback of this voice.

willwade commented 1 year ago

@taananas - mind explaining how highlighting is working and where this bug is stemming from?

gavinhenderson commented 1 year ago

It looks to me like the 'sentence detection' is thrown off by the Gujarati characters.

It reads through what I would expect on paragraph mode, but jumps sentences on sentence mode.

taananas commented 1 year ago

we have no gujariti voice for apple and the speech service doesтэt return the word range

gavinhenderson commented 1 year ago

@taananas Do we need to use the speech service to get the word ranges? Can we not build that ourselves by seperating on space characters and on new lines and full stops etc?

gavinhenderson commented 1 year ago

Not creating an issue as it seems related. Its seems to not be able to understand two letter words, it gets stuck on them when playing through in word mode. Even when using an english voice and only using english characters

https://user-images.githubusercontent.com/1359202/223453549-acdd3dc7-0826-4da2-baf7-4764bd2f7914.mov

gavinhenderson commented 1 year ago

I've had a quick look but need to dig further. It looks like we need to handle the ranges differently between NSRanges and String Ranges and NSRanges account for all kinds of characters but string ranges dont.

I switched out this line:

let range = rangeOffset..<(rangeOffset + range.length)
let prepairText = text[range]

for

let prepairText = String(text.substring(with: range) ?? "default")

Which seemed to solve some of the issues, but the highlight still isn't quite right. I can have more of a look later

taananas commented 1 year ago

@taananas Do we need to use the speech service to get the word ranges? Can we not build that ourselves by seperating on space characters and on new lines and full stops etc?

it doesn't really affect, but you can try to find something else.

gavinhenderson commented 1 year ago

Fixed in v1.1.5