karashiiro / TextToTalk

Chat TTS plugin for Dalamud. Has support for triggers/exclusions, several TTS providers, and more!
MIT License
47 stars 30 forks source link

Allow regex graphemes #111

Open karashiiro opened 2 years ago

karashiiro commented 2 years ago

Discussed in https://github.com/karashiiro/TextToTalk/discussions/104

Originally posted by **johnysandels** April 16, 2022 I was wondering if there was a way to use a regex to only replace a grapheme when the regex applies? So I could make the word `hm` get replaced while not messing with the word `hmm` or `Rhythm` . If some sort of Regex is currently possible I could just regex `\s*[hH]m\W` and then replace pronunciation of `hm` only after the regex matches. The process I was hoping for would be: ``` Grapheme "hm" detected if regex `\s*[hH]m\W` matches: Replace "hm" with "hm̩" else: do not replace ``` If this is either already possible, or able to be implemented, it'll be very helpful for short words that are pronounced weirdly, and avoid those short graphemes interacting with longer words that are not included in the lexicon. Example, a grapheme for "tis", would interact with satisfy. and would make is say " Sa tis F Y" https://user-images.githubusercontent.com/79720646/163666419-9a8dfc83-890f-4cf1-a5c1-eef24f830f23.mp4 (May need to unmute) It would also help with Characters and races with a `'s` contained within their names, that are read normally without needing correcting(thus not in the lexicon) getting broken in the same way with the grapheme `'s`. I could see possible issues with putting regex into the .pls file if a voice backend isn't expecting those contents and needing a separate file for regexing. If it's already possible though, it may not be a problem, and _may_ already be built into AWS and the system backend. I'm not sure, let me know if you know anything!