Sha256: 9a03553cdf3701ed516076c9f0899c4a05145058141110cccba93041bfe3aa98

Contents?: true

Size: 188 Bytes

Versions: 124

Compression:

Stored size: 188 Bytes

Contents

import re

from collections import Counter


WORDS = re.compile("[a-z0-9]+(['][a-z]+)?")


def word_count(text):
    return Counter(word.group(0) for word in WORDS.finditer(text.lower()))

Version data entries

124 entries across 124 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/python/exercises/word-count/example.py
trackler-2.2.1.179 tracks/python/exercises/word-count/example.py
trackler-2.2.1.178 tracks/python/exercises/word-count/example.py
trackler-2.2.1.177 tracks/python/exercises/word-count/example.py
trackler-2.2.1.176 tracks/python/exercises/word-count/example.py
trackler-2.2.1.175 tracks/python/exercises/word-count/example.py
trackler-2.2.1.174 tracks/python/exercises/word-count/example.py
trackler-2.2.1.173 tracks/python/exercises/word-count/example.py
trackler-2.2.1.172 tracks/python/exercises/word-count/example.py
trackler-2.2.1.171 tracks/python/exercises/word-count/example.py
trackler-2.2.1.170 tracks/python/exercises/word-count/example.py
trackler-2.2.1.169 tracks/python/exercises/word-count/example.py
trackler-2.2.1.167 tracks/python/exercises/word-count/example.py
trackler-2.2.1.166 tracks/python/exercises/word-count/example.py
trackler-2.2.1.165 tracks/python/exercises/word-count/example.py
trackler-2.2.1.164 tracks/python/exercises/word-count/example.py
trackler-2.2.1.163 tracks/python/exercises/word-count/example.py
trackler-2.2.1.162 tracks/python/exercises/word-count/example.py
trackler-2.2.1.161 tracks/python/exercises/word-count/example.py
trackler-2.2.1.160 tracks/python/exercises/word-count/example.py