Skip to main content

CountsDict

This class is a specialized dictionary that automatically populates missing keys with the frequency of that key's occurrence within a specified string. It extends the standard dictionary by implementing a custom missing key handler that calculates and stores character or substring counts on demand.

Attributes

AttributeTypeDescription
wordstringThe source string used to calculate character frequencies when a requested key is missing from the dictionary.

Constructor

Signature

def CountsDict(
*args: any,
word: string,
**kwargs: any
) - > null

Parameters

NameTypeDescription
*argsanyVariable length argument list for dictionary initialization.
wordstringThe string used to calculate character counts when a key is missing.
**kwargsanyArbitrary keyword arguments for dictionary initialization.

Signature

def CountsDict(
word: string,
*args: any,
**kwargs: any
) - > null

Parameters

NameTypeDescription
wordstringThe target string used as the source for counting occurrences of requested keys.
*argsanyPositional arguments passed to the parent dictionary constructor.
**kwargsanyKeyword arguments passed to the parent dictionary constructor.