szaydel

szaydel / Wordsgroupedbyfirstletter / 0.2.0

README.md

Overview

The function is a tokenizer of sorts, intended to break out text into buckets aggregated on first letter of each word. This function is useful for grouping words by first letter, and recording a count of each word's occurance. The function returns a dict of dicts, each keyed on a single letter. All words starting with that letter are then grouped in a child dict, with each word being the key and count of that word encountered in the input.

Usage

Input

Describe the input fields for your algorithm. For example:

ParameterDescription
inputA string of some number of words to be tokenized

Output

Describe the output fields for your algorithm. For example:

ParameterDescription
returnA dict of dicts

Examples

_When an input as follows is given, then output will be as seen below. Input: 'this is a test string' _

{
    't': {'this': 1, 'test': 1},
		's': {'string': 1},
		'i': {'is': 1},
		'a': {'a': 1},
}