Question: Regular expressions Problem 1. English Plurals Coding [10 points] While the English plural marker is written with an 's', in many cases it is actually

Regular expressions Problem 1. English Plurals Coding [10 points] While the English plural marker is written with an 's', in many cases it is actually pronounced as a 'z'. This happens when the final sound of the singular noun is voiced (produced with vibration of the vocal cords), because /2/ is the voiced counterpart of the voiceless /s/. The following table shows the other pairs of English consonants that are distinguished by voicing: Voiceless f p t k Voiced v bd g In addition, the sounds of 'm', 'n', 'r', and T are voiced, but they have no voiceless counterparts. Finally, all English vowels are voiced. Imagine you are an English spelling reformer who wants to rectify this misleading situation immedia ately. Implement the following function in Python, using the re .sub() method (from the built-in re package), to replace '-s' with '-2' in the appropriate cases. def fix_plurals (text: str) - str: . Use only one regular expression . Note that the input text can be many words long, with both whitespace and punctuation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!