How to resolve the algorithm I before E except after C step by step in the Maple programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm I before E except after C step by step in the Maple programming language

Table of Contents

Problem Statement

The phrase     "I before E, except after C"     is a widely known mnemonic which is supposed to help when spelling English words.

Using the word list from   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, check if the two sub-clauses of the phrase are plausible individually:

If both sub-phrases are plausible then the original phrase can be said to be plausible. Something is plausible if the number of words having the feature is more than two times the number of words having the opposite feature (where feature is 'ie' or 'ei' preceded or not by 'c' as appropriate).

As a stretch goal use the entries from the table of Word Frequencies in Written and Spoken English: based on the British National Corpus, (selecting those rows with three space or tab separated words only), to see if the phrase is plausible when word frequencies are taken into account.

Show your output here as well as your program.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm I before E except after C step by step in the Maple programming language

Source code in the maple programming language

words:= HTTP:-Get("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt"):
lst := StringTools:-Split(words[2],"\n"):
xie, cie, cei, xei := 0, 0, 0, 0:
for item in lst do 
	if searchtext("ie", item) <> 0 then
		if searchtext("cie", item) <> 0 then
			cie := cie + 1:
		else
			xie := xie + 1:
		fi:
	fi:
	if searchtext("ei", item) <> 0 then
		if searchtext("cei", item) <> 0 then
			cei := cei + 1:
		else
			xei := xei + 1:
		fi:
	fi:
od:	
p1, p2 := evalb(xie > 2*xei),evalb(cei > 2*cie);
printf("The first phrase is %s with supporting features %d, anti features %d\n", piecewise(p1, "plausible", "not plausible"), xie, xei);
printf("The seond phrase is %s with supporting features %d, anti features %d\n", piecewise(p2, "plausible", "not plausible"), cei, cie);
printf("The overall phrase is %s\n", piecewise(p1 and p2, "plausible", "not plausible")):

  

You may also check:How to resolve the algorithm Bitmap/Write a PPM file step by step in the Phix programming language
You may also check:How to resolve the algorithm Greatest element of a list step by step in the FutureBasic programming language
You may also check:How to resolve the algorithm Averages/Median step by step in the C programming language
You may also check:How to resolve the algorithm Bin given limits step by step in the Action! programming language
You may also check:How to resolve the algorithm Iterated digits squaring step by step in the Julia programming language