A while ago, I worked through the Word Count exercise and found the varied approaches interesting. Now that I have the time, I propose adding approach docs for the following approaches:
- A manual iteration approach with a variant that uses
itertools.chain() for performance
- A
str.maketrans()/str.translate() approach, with variants for manual looping vs collections.Counter
- A
re.split() plus collections.Counter approach
- A
re.findall() approach, either as its own doc or as a variation of the previous one
The iterations of my solution roughly correspond to each approach/variation in this list.
I would be happy to draft up a PR for this after some details are decided upon (such as one unified regex approach doc vs separate re.split() and re.findall() ones).
A while ago, I worked through the Word Count exercise and found the varied approaches interesting. Now that I have the time, I propose adding approach docs for the following approaches:
itertools.chain()for performancestr.maketrans()/str.translate()approach, with variants for manual looping vscollections.Counterre.split()pluscollections.Counterapproachre.findall()approach, either as its own doc or as a variation of the previous oneThe iterations of my solution roughly correspond to each approach/variation in this list.
I would be happy to draft up a PR for this after some details are decided upon (such as one unified regex approach doc vs separate
re.split()andre.findall()ones).