6 supports command line input of the text filename
source | link

Python3 (235244 bytes)

import re, collections as c, sys
t=''
with open('ssys.txt'argv[1]) as f:
    t+=f.read()
d=c.Counter([s for s in (re.sub('[\s\W]','\n',t).split('\n')) if s])
for x in sorted(d.items(), key=lambda x: x[1])[::-1]:
    print('{}:{}'.format(x[0],x[1]))

Works also with newlines, tabs etc. in the sample text.

Output

> $ python3 wc.py test.txt
a:2
text:1
is:1
This:1
and:1
number:1
31:1

Python3 (235 bytes)

import re, collections as c
t=''
with open('s.txt') as f:
    t+=f.read()
d=c.Counter([s for s in (re.sub('[\s\W]','\n',t).split('\n')) if s])
for x in sorted(d.items(), key=lambda x: x[1])[::-1]:
    print('{}:{}'.format(x[0],x[1]))

Works also with newlines, tabs etc. in the sample text.

Output

> $ python3 wc.py
a:2
text:1
is:1
This:1
and:1
number:1
31:1

Python3 (244 bytes)

import re, collections as c, sys
t=''
with open(sys.argv[1]) as f:
    t+=f.read()
d=c.Counter([s for s in (re.sub('[\s\W]','\n',t).split('\n')) if s])
for x in sorted(d.items(), key=lambda x: x[1])[::-1]:
    print('{}:{}'.format(x[0],x[1]))

Works also with newlines, tabs etc. in the sample text.

Output

> $ python3 wc.py test.txt
a:2
text:1
is:1
This:1
and:1
number:1
31:1
5 deleted 90 characters in body
source | link

Python3 (255235 bytes)

import re, collections as c
deft=''
with countopen('s.txt'):
    t='This is a text and aas numberf: 31.'
    t+=f.read()
d=c.Counter([s for s in (re.sub('[\s\W]','\n',t).split('\n')) if s])
    for x in sorted(d.items(), key=lambda x: x[1])[::-1]:
        print('{}:{}'.format(x[0],x[1]))

Works also with newlines, tabs etc. in the sample text.

Output

> $ python3 -c 'import short; shortwc.count()'                                                py
a:2
text:1
is:1
This:1
and:1
number:1
31:1

Python3 (255 bytes)

import re, collections as c
def count():
    t='This is a text and a number: 31.'
    d=c.Counter([s for s in (re.sub('[\s\W]','\n',t).split('\n')) if s])
    for x in sorted(d.items(), key=lambda x: x[1])[::-1]:
        print('{}:{}'.format(x[0],x[1]))

Works also with newlines, tabs etc. in the sample text.

Output

> $ python3 -c 'import short; short.count()'                                                
a:2
text:1
is:1
This:1
and:1
number:1
31:1

Python3 (235 bytes)

import re, collections as c
t=''
with open('s.txt') as f:
    t+=f.read()
d=c.Counter([s for s in (re.sub('[\s\W]','\n',t).split('\n')) if s])
for x in sorted(d.items(), key=lambda x: x[1])[::-1]:
    print('{}:{}'.format(x[0],x[1]))

Works also with newlines, tabs etc. in the sample text.

Output

> $ python3 wc.py
a:2
text:1
is:1
This:1
and:1
number:1
31:1
4 deleted 13 characters in body
source | link

Python3 (279255 bytes)

import re
from, collections import Counter as C, OrderedDictc
def count():
    t='This is a text and a number: 31.'
    d=Cd=c.Counter([s for s in (re.sub('[\s\W]','\n',t).split('\n')) if s])
    for x in sorted(d.items(), key=lambda x: x[1])[::-1]:
        print('{}:{}'.format(x[0],x[1]))

Works also with newlines, tabs etc. in the sample text.

Output

> $ python3 -c 'import short; short.count()'                                                
a:2
text:1
is:1
This:1
and:1
number:1
31:1

Python3 (279 bytes)

import re
from collections import Counter as C, OrderedDict
def count():
    t='This is a text and a number: 31.'
    d=C([s for s in (re.sub('[\s\W]','\n',t).split('\n')) if s])
    for x in sorted(d.items(), key=lambda x: x[1])[::-1]:
        print('{}:{}'.format(x[0],x[1]))

Works also with newlines, tabs etc. in the sample text.

Output

> $ python3 -c 'import short; short.count()'                                                
a:2
text:1
is:1
This:1
and:1
number:1
31:1

Python3 (255 bytes)

import re, collections as c
def count():
    t='This is a text and a number: 31.'
    d=c.Counter([s for s in (re.sub('[\s\W]','\n',t).split('\n')) if s])
    for x in sorted(d.items(), key=lambda x: x[1])[::-1]:
        print('{}:{}'.format(x[0],x[1]))

Works also with newlines, tabs etc. in the sample text.

Output

> $ python3 -c 'import short; short.count()'                                                
a:2
text:1
is:1
This:1
and:1
number:1
31:1
3 implementing sorting
source | link
2 Fixed code to match separators
source | link
1
source | link