I have made the following code which I shall explain it in two parts:
First Part:
ELCo = Alphabet["English"]; (*ELCo are the letters in English*)
Characters[ToLowerCase[WordList[Language -> "English"]]];
Select[%, SubsetQ[ELCo, ToLowerCase[#1]] &];
ELPr = Map[Sort, Map[DeleteDuplicates, %]]; (*In the past two steps I turn English words into characters and to lowercase*)
ELP = Length[ELPr];
ELPrPo = Total[x^Map[Length, ELPr]]; (*Here I make polynomials of english words based on their length, for example 3068 x^4 shows there are 3068 elements of size 4 and so on*)
This part of the code is fairly simple and easy to run. This is just the tool I need in second part of my code.
Second Part:
I first take the letters, there are 26 of them and make all the possible pairs: (there are 325 of them)
Pairs = Subsets[ELCo, {2}];
Then,
Table[LU = Select[ELPr, SubsetQ[#1, Pairs[[j]]] &]; (*I go through the original word list ELPr and select each pair to this part shall be done 325 times for each pair*)
LUer = Total[x^Map[Length, LU]]; (*Then I make the new polynomial for each pair after selection*)
LUerDelta = Expand[ELPrPo - LUer + LUer/x]; (*Use the new polynomial and the original one to make this equation*)
Table[c = i;
(27 - c)/
27 (Coefficient[LUerDelta, x, c]/Coefficient[ELPrPo, x, c]) //
N, {i, 1, 2}], {j, 1, Length[Pairs]}];
PairPerformance = AssociationThread[Pairs, %];
In the last part for each new LUerDelta
I want to make a ratio of the coefficients for c= 1
and 2
, but having two table command into each other makes this process very slow, I was wondering if there is a better way of doing this?