Regular Expressions and Pronunciation Corrections

Forum for TextAloud version 3

Moderator: Jim Bretti

Post Reply
Jim Bretti
Posts: 1558
Joined: Wed Oct 29, 2003 11:07 am
Contact:

Regular Expressions and Pronunciation Corrections

Post by Jim Bretti »

We'll try using this thread for help correcting pronunciations using Pronunciation Dictionary Maintenance.

When you add pronunciation dictionary entries to a TextAloud pronunciation dictionary, you can specify "Text Matching" as "Simple Text" or "Regular Expression". When setting the Text Matching fields for a Dictionary Entry, the general idea is to use Simple Text when a specific word, or specific string of text is causing pronunciation problems. You'll want to look at Masks or Regular Expressions when the pronunciation problem you're dealing with is not just one word, but rather a set of many words that have a common pattern. For example, if a voice was having a problem pronouncing year numbers that start with 19, you would want to use a pattern match that looks for 4 digit numbers starting with 19. The examples in this thread will deal primarily with using regular expressions. If you need help getting started using regular expressions there is a very good reference at http://www.regular-expressions.info/

In this example, and the examples that follow, display the Pronunciation Dictionary Maintenance dialog by clicking Tools -> Text Processing -> Pronunciation Dictionary Maintenance. You can either click "New Entry" to add a dictionary entry to an existing dictionary, or create a new dictionary first by clicking "New Dictionary", and add your entry(s) to the new dictionary. When creating the dictionary entries for these examples, you'll need to specify that text matching is performed by regular expression, just set the dropdown field labeled "Text Matching" to "Regular Expression".


Problem: Some voices pronounce text strings like "$20 million" as "twenty dollars million", instead of "20 million dollars".
Correct with a pronunciation dictionary entry using the following regular expression / respell:
Regular Expression:
\$(\d{1,3} (thousand|million|billion|trillion))

Respell:
$1 dollars
Jim Bretti
NextUp.com
PHenry1026
Posts: 231
Joined: Thu Jan 11, 2007 12:10 pm
Contact:

Re: Regular Expressions and Pronunciation Corrections

Post by PHenry1026 »

For a more general approach to correcting dollar pronunciation problems:

See the following post(thread): http://www.nextup.com/phpBB2/viewtopic.php?f=7&t=6058
Last edited by PHenry1026 on Sun May 12, 2013 6:07 am, edited 2 times in total.
Jim Bretti
Posts: 1558
Joined: Wed Oct 29, 2003 11:07 am
Contact:

Re: Regular Expressions and Pronunciation Corrections

Post by Jim Bretti »

When reading the Bible, how to correctly speak chapter / verse text like like this:
Genesis 11:20

Regular Expression
(?<=\b)(\d+?):(\d+?)(?=\b)

Respell
Chapter $1 Verse $2
Jim Bretti
NextUp.com
Post Reply