text – Convert from a (telephone) number to a short sentence in English

One way to memorize phone numbers is to convert the number into a simple phrase in natural language (for example, in English) so that when dialing on a keyboard, only one write out that word or phrase Here are the conversions, taken from a standard telephone keypad:

subs1 = {2 -> {"a", "b", "c"},
3 -> {"d", "e", "f"},
4 -> {"g", "h", "i"},
5 -> {"j", "k", "l"},
6 -> {"m", "n", "o"},
7 -> {"p", "q", "r", "s"},
8 -> {"t", "u", "v"},
9 -> {"w", "x", "y", "z"}};

(We will return to the subject of 0 Y one.)

Therefore, the telephone number (seven digits) 3987228 would become "excerpt", which the user simply writes to the phone, guided by the letters of the keyboard. (Note that, of course, a given number can have several valid corresponding words: 228 could be converted to "act", "bat" or "cat".)

Here is a simple code that finds (only) valid English words corresponding to a number (here 228):

Select[StringJoin /@ Tuples[IntegerDigits[228] /. subs1], DictionaryWordQ]

(*
{"act", "bat", "cat"}
*)

Equally:

Select[StringJoin /@ Tuples[IntegerDigits[5865] /. subs], DictionaryWordQ]

(* {trash} *)

The general problem becomes a little more complicated for two reasons. First, one must deal with the digits. 0 Y one, that do not have the corresponding letters on a keyboard. Second, a full 10-digit phone number rarely has a single corresponding word Therefore, it is necessary to modify the previous code to look for sets or phrases of valid words in English (of any length) according to the length of the number. (The semantic meaning of the phrase is irrelevant.) In addition, there are some heuristics, such as 0 it can be read as "oh", one It can be read as "one", etc.

So the phone number 2427793647 It could be represented as "2 happy dogs".

Here is an expanded set of substitutions that capture some of these ideas.

subs = {0 -> {"or"},
1 -> {"i", "one"},
2 -> {"a", "b", "c", "two", "also"},
3 -> {"d", "e", "f"},
4 -> {"g", "h", "i", "for"},
5 -> {"j", "k", "l"},
6 -> {"m", "n", "o"},
7 -> {"p", "q", "r", "s"},
8 -> {"t", "u", "v"},
9 -> {"w", "x", "y", "z"}};

What modification of the previous code would take an arbitrary 10-digit code?
phone and generate a sentence in English (from any number of
Word / components) that could be used to memorize this number?

Surely one will want to use a text for several chain divisions. For example:

test phrases = {"catdog", "longit", "hotbag"};

Select[testphrases, AllTrue[StringPartition[#, 3], DictionaryWordQ]&]

(*
{"catdog", "hotbag"}
*)

This proves by only two valid words generated by dividing the source string after the third character. We need to verify all division positions, and more simultaneous division positions (giving three or four or more components).