ComfyUI Extension: Comfy Text Stats
Node: Text Stats (Char & Word Count). A lightweight ComfyUI custom node that takes a text string and outputs character and word counts (INT). Ideal for caption preprocessing, prompt analytics, and dataset workflows.
Custom Nodes (0)
README
๐งฉ Comfy Text Stats (Char & Word Count)
A lightweight ComfyUI custom node that receives a text string and outputs:
- ๐งฎ Character count (
INT
) - โ๏ธ Word count (
INT
)
This node is designed for text preprocessing, caption analytics, or quick statistics inside your ComfyUI workflows.
๐ Features
โ
Simple and fast โ no dependencies
โ
Unicode-aware word detection (supports multilingual text)
โ
Deterministic results (not affected by seeds)
โ
Works with any STRING
input from other nodes
๐ฆ Installation
Option 1 โ Via ComfyUI-Manager (recommended)
- Download
comfy-text-stats.zip
- In ComfyUI-Manager, go to:
Install โ Install from ZIP - Select the ZIP file and click Install
- Then Reload Custom Nodes (or restart ComfyUI)
Option 2 โ Manual Install
- Extract the folder to your ComfyUI custom node directory:
ComfyUI/ โโโ custom_nodes/ โโโ comfy-text-stats/ โโโ __init__.py โโโ text_stats.py โโโ README.md โโโ requirements.txt
- Restart ComfyUI.
๐ง Usage
Node name
Text Stats (Char & Word Count)
Category:Text / Utils
Inputs
| Name | Type | Description |
|------|------|--------------|
| text
| STRING | The text input to analyze. Supports multiline input. |
Outputs
| Name | Type | Description |
|------|------|--------------|
| char_count
| INT | Number of characters (including spaces, punctuation, and newlines). |
| word_count
| INT | Number of words (using Unicode-aware regex). |
๐งช Example
Input text:
ComfyUI makes custom nodes easy!
Outputs:
char_count = 33
word_count = 5
๐ง Technical Details
- Word detection uses the regex:
which matches Unicode word boundaries.\b\w+\b
- The node is deterministic (
IS_CHANGED
checks text length for caching).
๐ก Use Cases
- Text preprocessing for captioning or prompt tuning
- Generating text metadata before feeding into LLM pipelines
- Measuring caption sizes in dataset workflows
๐ License
MIT License ยฉ 2025 โ freely usable and modifiable.
Contributions welcome!