Generate a Texting Dictionary

Mathematica, 202 bytes

{g[#],##}~r~" "&@@@GatherBy[#&@@@SortBy[Tally@StringReplace[StringSplit@#,x_/;!LetterQ@x->""],-Last@#&],g=""<>ToString/@(\[LeftFloor]If[#<113,(#-91)/3,(#-88.2)/3.4]\[RightFloor]&/@ToCharacterCode@#)&]~(r=Riffle)~"
"<>""&

Note that \[LeftFloor] and \[RightFloor] are 3 bytes each.


C++, 566 533 bytes

-33 bytes thanks to Zacharý ( about 20 bytes ) and user202729 ( about 12 bytes )

#include<map>
#include<string>
#include<fstream>
#include<regex>
#include<set>
using namespace std;using s=string;struct z{s d;int f;int operator<(z a)const{return f<=a.f&&d<a.d;}};regex r("[^a-z]");void g(){fstream e("a"),o("d",ios::out);map<s,int>m;while(!e.eof()){s t;e>>t;t=regex_replace(t,r,"");++m[t];}map<s,set<z>>t;for(auto a:m){s k;for(auto c:a.first)k+="22233344455566677778889999"[c-97];t[k].insert({a.first,a.second});}for(auto&a:t){o<<'\n'<<a.first<<' ';for(auto m=a.second.rbegin();m!=a.second.rend();++m)o<<m->d<<' ';}}

Uses a set to ensure that the words in the z struct are ordered, so a reverse iterator loop can be done.


Perl 5, 123 bytes + 1 (-a) = 124 bytes

y/A-Z//dc&$k{y/A-Z/22233344455566677778889999/r}{$_}++for@F}{$,=$";say$_,sort{$k{$_}{$b}-$k{$_}{$a}}keys%{$k{$_}}for keys%k

Try it online!

Takes input as uppercase.