๐ผ> Clear Text
Randomly wipe a prompt fragment, weighted by a probability you set
- text
A one-job node: it takes a text string and, by a chance you set, either passes it through unchanged or wipes it to an empty string. It's the node-graph version of the old A1111 {80%::keyword|} weighted-wildcard trick people use to randomly include or drop a prompt fragment across a batch - except here it's an explicit node instead of syntax baked into the prompt text, which is easier to see and tune at a glance in a graph.
The obvious use: you've got an optional style fragment ("dramatic lighting, high contrast") that you want present in most generations but not every single one, so a batch of results doesn't all look identically styled. Route that fragment through Clear Text with chance set to something like 0.3, and roughly 30% of runs will drop it entirely while the rest keep it, then combine the (possibly empty) result with your base prompt using Text Combine.
How it works
chance is a probability from 0.0 (never clear, text always passes through) to 1.0 (always clear, text is always emptied). Each run, the node rolls against that probability and either returns your input text unchanged or an empty string.
The inputs and outputs that matter
text- the string that might get wiped.chance(default0, range 0.0โ1.0) - the probability of clearing it.0.0means 0% chance (text always survives),1.0means 100% chance (text is always emptied). Default is0, so nothing happens unless you explicitly raise it.
One output: text - either your original string or an empty one, depending on the roll. Downstream, combine it with the rest of your prompt using Text Combine - when it's empty, you'll want a delimiter setup that doesn't leave a stray comma or extra space behind.
How to install it
Via ComfyUI Manager: search "yanc" or "YANC - Yet Another Node Collection," install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ALatentPlace/ComfyUI_yanc
then restart. No extra dependencies, no downloads.
Common issues & troubleshooting
Nothing ever gets cleared. chance defaults to 0, meaning 0% - you have to explicitly raise it. This trips people up because the parameter name reads like a boolean toggle at a glance; it's a probability, not an on/off switch.
Text gets cleared every single time. Check you haven't set chance to 1.0 by mistake, or misread it as "1 in however many" rather than a 0โ1 probability scale.
No visible randomness - same result every run. ComfyUI generally caches node outputs when nothing upstream has changed between queues, and this node has no seed input to force a fresh roll. If you need it to actually re-roll each run rather than reuse a cached result, make sure something in the graph is changing between executions (a batch count greater than one, or a changing dummy input elsewhere), since a static single-run graph may not re-trigger this node's randomness at all.
Leftover delimiter/spacing when the text gets cleared. This isn't a Clear Text bug so much as a downstream combine issue - if you're feeding the (now empty) output into Text Combine with a fixed delimiter, you can end up with a stray ", " at the start or end of your final prompt. Worth checking your combine logic handles the empty case cleanly.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | โ | |
| chance | FLOAT | 0.000โ1 | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | โ |