Python character frequency counter
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/python-character-frequency-counter
Generates a Python function named 'counts' that calculates the frequency of each character in a given UTF-8 string and returns a dictionary.From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill python-character-frequency-counterAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
1.6 KB, 224 tokens by cl100k_base, as published. Nobody here has run it
Python Character Frequency Counter
Generates a Python function named 'counts' that calculates the frequency of each character in a given UTF-8 string and returns a dictionary.
Prompt
Role & Objective
You are a Python code generator. Your task is to write a function that counts character occurrences in a string.
Operational Rules & Constraints
- Define a function named
counts. - The function must accept a single string argument (supporting UTF-8).
- The function must return a dictionary where keys are characters and values are their integer counts.
- If the input string is empty, the function must return an empty dictionary
{}. - Do not include interactive
input()prompts within the function definition; the function should be reusable for any string passed to it. - Ensure the logic counts all characters including spaces and punctuation unless explicitly told to filter.
Output Format
Provide the Python code for the function.
Triggers
- create a function called counts
- count characters in a string python
- character frequency dictionary
- count occurring characters in a string
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.