this post was submitted on 14 Aug 2024
9 points (100.0% liked)

techsupport

2447 readers
1 users here now

The Lemmy community will help you with your tech problems and questions about anything here. Do not be shy, we will try to help you.

If something works or if you find a solution to your problem let us know it will be greatly apreciated.

Rules: instance rules + stay on topic

Partnered communities:

You Should Know

Reddit

Software gore

Recommendations

founded 1 year ago
MODERATORS
 

Follow-up to this thread - this is way more specific, so hopefully worthy of its own thread. I think wildcards are the best option for my skill level (basically none), and have gotten a good chunk of what I wanted to accomplish done with those.

An issue I've run into and can't seem to google my way out is making TTS pronounce acronyms in a sensible way. For example "PACU" (post-anesthesia care unit) is usually vocalized as "pack-you" but my TTS software likes to say things like "pace-uh". Or "PO" (latin abbreviation for 'by mouth') is vocalized by just saying the letters, but TTS says "Poe". Stuff like that.

When the TTS comes across a capitol letter with a space on either side, it just pronounces the letter, so I'd still lose things like "pack-you" but at least hearing it spell out "pee ay see you" would make sense, vs "pace-uh" which is gibberish and confusing at high playback speeds.

Best I've come up with so far is <([A-Z]{2})> on the Find side, but that's only spotting the two character terms like PO, and ignoring the longer ones... I'd hoped it would see PACU and detect PA, AC, and CU as three distinct sets of two that could cobbled into "P A C U".

Nothing I've done on the Replace side comes close to working. It either does nothing at all, or it'll do something like turn "PO" into <([A- Z]{2})>. Not sure if preserving the original characters is something A-Z is actually capable of - seems not, but I'm kind of an idiot with stuff like this, so any tips would be appreciated!

Thank you!

top 9 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 2 months ago* (last edited 2 months ago) (3 children)
Find: ([A-Z])([A-Z])
Replace: \1 \2

Click the "Replace All" twice and it should do what you need.

Unfortunately it seems like MS Word uses a non standard configuration for advanced searches so functions like "positive lookahead" are not available. That's why you need to replace twice.

What TTS software are you using? Is there a way to add pronunciation guides that will apply across all software, not just word?

Edit: Untested:

Replace (without quotes): "\1 \2 "

This might mean you only need to replace once, but it will add an extra space after acronyms ("PACU" > "P A C U ") and will inject space in mixed case scenarios ("PACUpacu" > "P A C U pacu").

[–] [email protected] 2 points 2 months ago (1 children)

Just ran it and it worked beautifully!

Extra spaces are fine - the actual document can be ugly as sin, so long as it plays well audibly - and it does!

What TTS software are you using? Is there a way to add pronunciation guides that will apply across all software, not just word?

Online service called Speechify. Its basically a deepfake of a chunk of recorded speech combined with a text input. I can't change the pronunciation directly, but the different voice actors all have their own patterns. How they tackle acronyms or medical terminology is hit and miss. I try to cycle through them despite that though, since I'll start to lose focus listening to the same voice for too long.

Once this semester wraps up, I kinda want to give myself a crash course on regex. Even my newbie ass can see the crazy useful potential in knowing that stuff, especially in the medical field, cuz computer literacy is pretty horrific here (twice I've walked passed an office and looked in to see some department manager squinting at an Excel sheet, then punching some numbers into a calculator - a physical calculator, that they're holing in their hand like a god damned monkey - then typing some shit into Excel one index finger stroke at a time, squint, calculator, type, etc.... I die a little inside each time... Y U NO FORMULA?! Y U NO USE OTHER 8 FINGERS?!?!)

[–] [email protected] 2 points 2 months ago (1 children)
[–] [email protected] 1 points 2 months ago

Oh shit, look at that. I'll have to play with that - however, I think your find and replace solution will do the best work here. Planning on hitting entire textbooks at a time, so I can just have a quick fix-it nuke at the start of any assigned readings, then spend the rest of my time actually reading/listening. Customizing each one would be cleaner for sure, but yours will let me correct hundreds of different acronyms at a time - and even though people don't usually spell out "P A C U" when speaking it, hearing it spelled out will at least make sense, and that's enough to learn my objectives, nuke the next textbook, and repeat.

[–] [email protected] 2 points 2 months ago

The more I play with this the more I love it. Just modified your code to produce:

Find ([0-9])/([0-9])

Replace \1 over \2

which changes things like "blood pressure 129/81" to "blood pressure 129 over 81" to prevent TTS from saying a fraction like "blood pressure one-hundred and twenty nine eighty firsts"

...will have to check for actual fractions first, but in the context, two numbers separated by a slash is pretty much always blood pressure.

Hell yeah!

[–] [email protected] 0 points 2 months ago (1 children)

Won't this just reverse the order of the two groups? (My regex is minimal)

[–] [email protected] 1 points 2 months ago

The parenthetical groups in the search query define what is to be captured. They are numbered from left to right. In this case that is a capital letter assigned to group 1 and then an immediately following capital letter assigned to group 2. If we used a replace of only "\1\2" then we would get no change from the original input. If we want to switch them then we just need to swap the order in the replace "\2\1".

[–] [email protected] 0 points 2 months ago* (last edited 2 months ago) (1 children)

Maybe replace the acronym with the closest word phonetically?

Since PACU sounds like "pack you", just do a search and replace - at least in the doc that's going to be read out by TTS.

This may not solve all acronyms, but it'll get some, and quickly, leaving more time for working on the more difficult things.

Is there any way to modify your TTS utility? (Does it accept a user dictionary?)

[–] [email protected] 1 points 2 months ago* (last edited 2 months ago)

That'd work for smaller documents - I'm planning on hitting entire text books in one go, and there are hundreds of these acronyms. Time is an insanely valulable resource once the semester gets into full swing, so being able to tackle huge chunks of prep in a few clicks gives me that much more time to read/listen to the actual content.

The TTS I'm using is "Speechify" - it sounds pretty good on its own most of the time, but acronyms are hit and miss. ~~It doesn't offer much customizeability beyond selecting a voice and speed - no user dictionary that I'm aware of.~~ (apparently it does to some extent - I'll need to play around with that)