Write a regular expression that matches violations of the old spelling rule I before E except...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a regular expression that matches violations of the old spelling rule "I before E except after C or when sounded like A as in neighbor or weigh" [14]: SPELL RE r'(71) (?!cie) ([a-z) |^)([^a-z]+)([ie]) (?! [a-z]}'" The following code block will test your regular expression by trying it against a bunch of strings. If your answer is correct it should pass 100% of the tests. [15]: Wipytest WRONG = ('peice', 'beleive', 'greif', 'cieling', 'recieve', 'wieght', 'frieght") RIGHT= ('piece', 'believe', 'grief, 'ceiling', 'receive', 'weight', 'freight") @pytest.mark.parametrize('text, is_error', [(x, True) for x in WRONG] + [(x, False) for x in RIGHT]) def test spell(text, is_error): assert bool(re.search(SPELL_RE, text)) == is_error Write a regular expression that matches violations of the old spelling rule "I before E except after C or when sounded like A as in neighbor or weigh" [14]: SPELL RE r'(71) (?!cie) ([a-z) |^)([^a-z]+)([ie]) (?! [a-z]}'" The following code block will test your regular expression by trying it against a bunch of strings. If your answer is correct it should pass 100% of the tests. [15]: Wipytest WRONG = ('peice', 'beleive', 'greif', 'cieling', 'recieve', 'wieght', 'frieght") RIGHT= ('piece', 'believe', 'grief, 'ceiling', 'receive', 'weight', 'freight") @pytest.mark.parametrize('text, is_error', [(x, True) for x in WRONG] + [(x, False) for x in RIGHT]) def test spell(text, is_error): assert bool(re.search(SPELL_RE, text)) == is_error
Expert Answer:
Answer rating: 100% (QA)
To create a regular expression that matches violations of the old spelling rule I before E except af... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
a. Given the following information, calculate the expected value for Firm Cs EPS. Data for Firms A and B are as follows: E(EPS A ) = $5.10, and A = $3.61; E(EPS B ) = $4.20, and B = $2.96. b. You...
-
A one-dimensional infinite well of length 200 pm contains an electron in its third excited state. We position an electron-detector probe of width 2.00 pm so that it is centered on a point of maximum...
-
Let A be an m x n matrix, let P be the projection matrix that projects vectors in Rm onto R(A), and let Q be the projection matrix that projects vectors in R" onto R(AT). Show that (a) I - P is the...
-
In Example 9.8, consider the situation from the instant the brick is released to the instant at which it has zero velocity (when the spring compression is greatest). Draw an energy diagram for a...
-
Tim Cooper plans to invest money in a mutual fund that is tied to one of the major market indices, either the S&P 500 or the Dow Jones Industrial Average. To obtain even more diversification, Tim has...
-
A student addresses a bully mocking another student, " what you're doing isn't even clever or funny, everyone has a right ti express who they are.. you know like we say every morning.. liberty and...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Explain the mechanism of a Digital Signatures which is recognized under the Information Technology Act, 2000 and state at least two (2) of its applications
-
True Or False There is no intent needed for a strict liability case.
-
True Or False If a defendant promises to buy the plaintiffs house for $100,000 but actually has no intention of doing so, and the plaintiff sues for breach of contract, the defendant will probably...
-
For a plaintiff to recover for public nuisance, the harm caused by the defendants conduct must be ____________.
-
What is the rationale underlying strict liability for defective products?
-
True Or False An owner of a chimpanzee be strictly liable for injuries to another.
-
Consider the inverse sine function, defined by y = sin x or y = arcsinx. Complete parts (a) through (d). (a) What is its domain? (Type your answer in interval notation. Simplify your answer. Type an...
-
Per Bag Direct materials: 25 pounds of CWhiz-2000 @ $0.08/lb. = $ 2.00 Direct labor: 0.05 hour @ $32.00/hr. = $ 1.60 The company manufactured 100,000 bags of Cheese-Be-Good in December and used...
-
Ken (age 31) and Amy (age 28) Booth have brought you the following information regarding their income, expenses, and withholding for the year. They are unsure which of these items must be used to...
-
Marty is a sales consultant. Marty incurs the following expenses related to entertainment of his clients in 2012: Dues to a country club......................................................$4,500...
-
Scott Butterfield is self-employed as a CPA. He uses the cash method of accounting, and his Social Security number is 644-47-7833. His principal business code is 541211. Scott's CPA practice is...
-
True or False: Annual worth analysis is the most popular DCF measure of economic worth.
-
Consider a palletizer at a bottling plant that has a first cost of \($150,000,\) operating and maintenance costs of \($17,500\) per year, and an estimated net salvage value of \($25,000\) at the end...
-
True or False: Unless non-monetary considerations dictate otherwise, choose the mutually exclusive investment alternative that has the greatest annual worth over the planning horizon.
Study smarter with the SolutionInn App