Keyword counter
Find the duplicate keyword wrecking your prompt
- ui_widget
- chart_dataset
- chip_dataset
Long prompts have a quiet failure mode: the same keyword appears three times because you keep appending and never read back. LF_KeywordCounter exists to catch exactly that. Feed it a prompt and it counts each keyword, then shows the counts as a bar chart right on the node - the fastest way to find out your "masterpiece" is pulling quadruple duty.
The author built it for this purpose and said so plainly: it's a bar chart for finding keywords defined multiple times in a single prompt. For tag-based workflows (the SDXL-lineage style where prompts are comma-separated Danbooru tags), it doubles as a prompt audit - you see at a glance what you're weighting by accident, because repetition is weighting.
How it works
Two inputs: prompt (multiline, the text to analyze) and separator (default , - the character(s) that split one keyword from the next). Change the separator to match your prompt's conventions and the node re-splits accordingly.
Outputs are both JSON, which might surprise you until you realize the chart is the frontend and the data is the product:
chart_dataset- the counts structured for the bar-chart widget. This is what the node displays.chip_dataset- the same data arranged as chips, for a clickable readout of each keyword with its count.
Since the node is flagged as an output node (is_output_node in the schema), it's meant as a terminal inspection point. But the JSON outputs mean you can also wire the counts into downstream logic - say, flagging a prompt that's over-weighted on one term before it runs. It's an analytics node with a genuinely automatable output.
Installing it
Part of LF Nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/comfyui-lf
Restart ComfyUI, or search LF Nodes in ComfyUI Manager. No model downloads; pure text processing with the pack's light dependencies.
Gotchas
The separator matters more than it looks. If your prompt uses commas without spaces (tag1,tag2) but the default separator is , (comma-space), every tag gets counted as one giant keyword. Match the separator to your prompt's actual formatting or the chart is noise.
And remember the count is about duplicates, not quality. A keyword appearing once is fine; this node won't tell you whether your prompt is good, only what you're repeating. For that first pass of prompt hygiene, though, it's genuinely handy.
Pack note: comfyui-lf is legacy, frozen Feb 2025; the author's active work is in lucafoscili/lf-nodes, where the chart widgets got rebuilt on LF Widgets.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Prompt containing keywords to count. | |
| separator | STRING | , | Character(s) used to separate keywords in the prompt. |
| ui_widgetopt | KUL_COUNT_BAR_CHART | [object Object] | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| chart_dataset | JSON | — |
| chip_dataset | JSON | — |