Split MixedCase Wods

Forum for TextAloud version 4

Moderator: Jim Bretti

Post Reply
ancLogan
Posts: 11
Joined: Sat Nov 09, 2019 1:17 pm
Contact:

Split MixedCase Wods

Post by ancLogan »

In the speaking Rules: Other Roles section, one of the options is “Split MixedCase words into multiple words. When I check that option, however, it does not work. Did I misunderstand its purpose? Most of the books I read aloud are programming book that tends to have a lot of camel case words example: constantName, dataType, btnAdd, etc… however, the software does not read them as two separate words. Can you help?
Jim Bretti
Posts: 1558
Joined: Wed Oct 29, 2003 11:07 am
Contact:

Re: Split MixedCase Wods

Post by Jim Bretti »

This is actually a small bug in the speaking rule that handles mixed case. The rule is only working for words beginning with an upper case letter, like MixedCase, and we're not handling camelCase. I should have this fixed in an updated version of TextAloud in the next day or so.

If you need to handle manually in the meantime, a TextAloud pronunciation dictionary entry configured like this should work:

Text Matching: Regular Expression
(?<=\p{Ll})(?=\p{Lu}\p{Ll})

Pronounce Using: Respell
<s>

The pattern is looking for a lower case letter, followed by an upper case letter and another lower case letter, The respelling inserts a space (<s>) before the upper case letter in the match.
Jim Bretti
NextUp.com
Jim Bretti
Posts: 1558
Joined: Wed Oct 29, 2003 11:07 am
Contact:

Re: Split MixedCase Wods

Post by Jim Bretti »

The bug I mentioned in the above post is now fixed. The speaking rule for handling mixed case words should now handle camel case correctly.

The problem is fixed in TextAloud version 4.0.51.2, the installer can be downloaded the from https://nextup.com/files/ta4.exe.
Jim Bretti
NextUp.com
ancLogan
Posts: 11
Joined: Sat Nov 09, 2019 1:17 pm
Contact:

Re: Split MixedCase Wods

Post by ancLogan »

Thank you. I have downloaded the new version. Thank you also for taking the time to write the regular expression. I am trying to get my head around regular expressions... However, I am struggling a bit at the moment. Thank you for your help.
ancLogan
Posts: 11
Joined: Sat Nov 09, 2019 1:17 pm
Contact:

Re: Split MixedCase Wods

Post by ancLogan »

Jim,

The Regular Expression below handles this situation 'txtPrint'.

Text Matching: Regular Expression
(?<=\p{Ll})(?=\p{Lu}\p{Ll})

To handle a situation like this 'txtFirstName would the Regular Expression below work?
Text Matching: Regular Expression
(?<=\p{Ll})(?=\p{Lu}\p{Ll})(?=\p{Lu}\p{Ll})

Or is there a more elegant solution?
I am still new to Regular Expression :)
Jim Bretti
Posts: 1558
Joined: Wed Oct 29, 2003 11:07 am
Contact:

Re: Split MixedCase Wods

Post by Jim Bretti »

Actually the original regular expression:
(?<=\p{Ll})(?=\p{Lu}\p{Ll})

should work with both cases txtPrint and txtFirstName. When processing txtFirstName, the expression should match "tFi" and insert a space before "F", then match "tNa" and insert another space before the "N".

Also, the speaking rule to handle mixed case words should handle this for you, you really shouldn't need to create pronunciation dictionaries at all.

Let me know if its not working, there may be something else going on that I'm missing

If you're looking for a reference the site http://www.regular-expression.info is pretty good.
Jim Bretti
NextUp.com
Post Reply