Nodes/comfyui-watdafox-nodes/Unique Text Advanced (watdafox)
ComfyUI Node

Unique Text Advanced (watdafox)

Dedupe tags that aren't actually spelled the same

By postosh·Created 9 months ago·Updated 8 months ago· 0
Unique Text Advanced (watdafox)
    • unique_text
    • duplicate_text
    remove_whitespacestrue
    remove_underscorefalse
    text

    Plain Unique Text splits your comma list into unique and duplicate strings. This one adds the two normalization toggles that make dedupe actually correct on real-world tag lists: remove_whitespaces and remove_underscore.

    Here's why that matters. Scraped tag lists and hand-assembled prompts are riddled with near-duplicates: cat , cat (with a stray space), red_eyes vs red eyes, lora:foo:1.0 on its own line vs after a comma. A dumb string comparison calls those all distinct, so your "dedupe" keeps every one. The Advanced node normalizes items before comparing - collapse whitespace, treat underscores as spaces - so genuine duplicates collapse into one, while the output keeps the formatting of the first occurrence. That's the difference between a dedupe that feels like it worked and one that silently didn't.

    How it works

    Both toggles default to sensible positions: remove_whitespaces on (strips surrounding space, collapses internal runs to a single space, drops empty tokens from ,,), remove_underscore off (so _ is preserved unless you ask otherwise). Duplicate detection uses the normalized form as a key, but the duplicate_text output keeps the raw tokens so you can see what actually repeated. As with the plain version, anything containing uppercase BREAK is always treated as unique - that's the ComfyUI line-break token and the author deliberately refuses to collapse it. Case-sensitive, so Cat and cat still count as different.

    The inputs and outputs

    • remove_whitespaces (default true), remove_underscore (default false), text (multiline).
    • unique_text - joined with ", " when whitespace removal is on, "," when off.
    • duplicate_text - raw duplicates, comma-joined.

    Both outputs are STRING and route into any prompt/text consumer. Category: watdafox/string.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/OhSeongHyeon/comfyui-watdafox-nodes.git
    

    Restart ComfyUI, or ComfyUI Manager → "comfyui-watdafox-nodes". No pip deps, no downloads.

    The trade-off

    Normalization is a blunt instrument. If your tag list genuinely contains red_eyes and red eyes as separate intentional tags, turning remove_underscore on will merge them - which is usually what you want, but be aware you're opting in. If your lists are already clean, the plain Unique Text node is lighter and does the job without touching your formatting.

    Categorywatdafox/string

    Inputs (3)

    NameTypeDefaultDescription
    remove_whitespacesBOOLEANtrue
    remove_underscoreBOOLEANfalse
    textSTRING

    Outputs (2)

    NameTypeDescription
    unique_textSTRING
    duplicate_textSTRING