文本按条件判断🐠meeeyo.com
Turn 'is this prompt good enough' into a clean 0 or 1
- INT
- STRING
TextConditionCheck is a gate. It looks at a block of text, tests one or two conditions against it, and answers with a plain 1 or 0 - as both an INT and a STRING output. That's the entire job, and it's the node you reach for when you want the graph to make a decision instead of you: only run the hires pass when the prompt is long enough, fall back to a backup prompt when the negative prompt is a wall of commas, skip generations when the prompt box is suspiciously empty.
It ships in the MeeeyoAI/ComfyUI_StringOps pack, so expect Chinese labels on the defaults (the inputs themselves are just text fields, no dropdowns to translate).
The three inputs
- original_content - the multiline text you're testing.
- length_condition - a character-count rule, default
3-6. A dash means an inclusive range (3-6passes when the text is 3 to 6 characters long); a bare number like10means exactly 10 characters. Character count, not word count. - frequency_condition - the part that makes this node interesting. It's a
character,countrule, and you can chain several with|.a,2means "must contain exactly two 'a' characters";a,2|b,1means "two a's and one b."
The logic is an AND: length check passes and every frequency rule passes, and you get 1; otherwise 0.
Where people get burned - this one is real
The default frequency_condition is empty, and the node does not handle an empty value. The code splits the empty string and tries to unpack a char,count pair out of it, which raises a ValueError - so the node errors out on its very first run if you leave it at defaults. This isn't a rumor, it's in the shipped source. The fix is to give it at least one rule. Want "no restriction on frequency" spelled out? Use a,0 - a rule that reads "zero 'a' characters," which is true unless your text happens to contain one. Annoying, but trivial once you know.
One more subtlety: these are plain substring counts, not word counts. The character a matches every lowercase a inside longer words too. If that's not what you want, this node is the wrong tool - CountOccurrences in the same pack has the same behavior, so keep expectations in line.
Wiring it into the graph
Feed the INT output into a Switch / If-else style node to pick between two branches, or into CompareInt to build multi-stage decisions. Feed the STRING output into another text node if you're building prompts conditionally. Because both outputs carry the same value, you can do both at once.
Installing
Standard pack install - Manager (search ComfyUI_StringOps) or clone:
cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
Restart, and the whole "Meeeyo" menu appears. No models to download, and the dependency list is light enough that conflicts are unlikely. It also re-evaluates every queue run (the pack marks these nodes as always-changed), which for a gate node is exactly what you want - conditions get re-tested live instead of going stale.
TextConditionCheck is small, and the empty-frequency gotcha makes it feel half-finished on first contact. Fix that one default and it's genuinely useful for prompt-based branching.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| original_content | STRING | — | |
| length_condition | STRING | 3-6 | — |
| frequency_condition | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |
| STRING | STRING | — |