Repository navigation
Add characters_without_whitespace to the Text Analyzer - #19
Merged
kushagarwal2910-lang merged 1 commit intoOct 22, 2026
Conversation
analyze_text now reports how many characters are not recognized by str.isspace(), next to the existing characters count. Punctuation and digits still count, and empty or whitespace-only input is zero. Existing fields are unchanged. Tests cover the documented example, spaces/tabs/newlines plus a Unicode non-breaking space, and the updated exact result for empty text; the tool guide documents the field.
kushagarwal2910-lang
merged commit Oct 22, 2026
26cb37d
into
github-community-gitam:main
4 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes #10.
analyze_textnow reportscharacters_without_whitespacealongside the existingcharacterscount. It counts every character for whichstr.isspace()is false, so punctuation and digits still count and spaces, tabs, newlines and a Unicode non-breaking space do not.Scope
src/mcp_tools_lab/tools/text.py— one new field plus a docstring note.tests/test_text.py— updated the exact-result assertion for empty text and added three focused tests.docs/tool-guide.md— documents the new field.Tests added
"Hi there!\n"→characters=10,characters_without_whitespace=8."a, 1\tb"→characters=6,characters_without_whitespace=4." \t\r\n\u00a0"→characters=5,characters_without_whitespace=0,words=0.Checks
python -m pytest tests/test_text.py -q— 6 passedpython -m pytest -q— 65 passedpython examples/try_tools.py— runs, shows the new fieldpython .github/scripts/check_rules.py—Scanned 11 files under src/ for print() and network imports: OKPython: 3.13 on Windows 11.
Note on issue choice: #1 ("Count empty lines") already has a claim comment from another contributor and is not assigned, so per
contributions.md("wait for a maintainer to confirm if the issue is already claimed") I took this separate starter task instead. Happy to hold both until a maintainer confirms.(Full disclosure: I used an AI coding assistant for this change, and I reviewed and verified everything submitted here.)