ComfyUI Node

Clear Tag

Clear Tag is a normalizer in disguise — it cleans up Title Case, not tags

By AiMiDi·Created 2 years ago·Updated 2 years ago· 0
Clear Tag
    • STRING
    tag_text

    The name is a lie. Clear Tag doesn't clear anything - it cleans. Feed it a comma-separated tag string and it normalizes every tag that's written in Title Case (first letter capital, the rest lowercase) to all-lowercase, and strips trailing periods while it's at it. Cowboy Shot. becomes cowboy shot. 1girl stays 1girl. It's a formatter for tag strings, not an eraser.

    So when would you actually reach for it? Any time your tags arrive in "pretty" human form instead of the lowercase, no-punctuation form Danbooru-trained models expect. This happens constantly when you pull captions from image filenames, from a .txt sidecar someone wrote by hand, or from a metadata dump that kept the periods. On SDXL-lineage models - Illustrious, NoobAI, Pony, WAI - the tag vocabulary was trained lowercase, so Cowboy Shot and cowboy shot aren't reliably the same token to the model. Normalizing before the prompt hits the sampler removes a whole class of "why is this tag doing nothing" mystery.

    How it works

    The node splits your tag_text on commas, trims whitespace, drops empty entries, then applies one rule to each tag: if the first character is uppercase and the rest is lowercase, lower the whole thing and remove any periods. Anything that doesn't match that shape - all-caps BLACK, numeric 1girl, already-lowercase tags, tags with brackets - passes through untouched. It's deliberately conservative.

    That conservatism is the practical thing to understand. This is not a "make everything lowercase" utility; it's a "fix the tags that look like sentence fragments" utility. If your source has Hatsune Miku (two capital words, so tag[1:].islower() fails), it won't touch it. Keep that in mind before you trust it to fully normalize a messy caption.

    Inputs and output

    This is the simplest node in the pack: a single optional tag_text input and a single STRING output. Nothing else. If you're building a prompt-cleanup chain, the typical order is: some tag source → Clear TagMerge Tag or Move Tag To Top for ordering → the sampler.

    Installing it

    Same story as the rest of the ComfyUI-Aimidi-nodes pack: no dependencies beyond what ComfyUI already ships, no models to download. The README is empty, so the source is the only documentation - and it's a straightforward one. Install via ComfyUI Manager (search ComfyUI-Aimidi-nodes) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AiMiDi/ComfyUI-Aimidi-nodes
    

    Restart and look for the blue ComfyUI Aimidi Nodes: Loaded console message.

    Common issues

    The most common "problem" is a misunderstanding of the name: people expect it to remove tags and see no change. It doesn't remove anything. Second most common: feeding it a single long string with no commas - it splits on commas, so Cowboy Shot. Portrait. becomes two tags, not one. And if your output looks unchanged, double-check the input actually contains Title Case tags; all-lowercase input will pass straight through, which is by design.

    CategoryAimidi Nodes

    Inputs (1)

    NameTypeDefaultDescription
    tag_textoptSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING