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
| Attribute | Type | Description |
|---|---|---|
| word | string | The 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
| Name | Type | Description |
|---|---|---|
| *args | any | Variable length argument list for dictionary initialization. |
| word | string | The string used to calculate character counts when a key is missing. |
| **kwargs | any | Arbitrary keyword arguments for dictionary initialization. |
Signature
def CountsDict(
word: string,
*args: any,
**kwargs: any
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| word | string | The target string used as the source for counting occurrences of requested keys. |
| *args | any | Positional arguments passed to the parent dictionary constructor. |
| **kwargs | any | Keyword arguments passed to the parent dictionary constructor. |