ComfyUI Node

Merge String List

Marge is a typo — and it's still the handiest tag-deduper in your workflow

By palealloy2999-prog·Created 4 months ago·Updated 4 months ago· 0
Merge String List
    • text
    text
    separator,
    sort_tagsfalse
    case_sensitivefalse

    Merge String List is a dead-simple node that takes one or more tag lists - usually the STRING list output of a WD14 Tagger or similar - and welds them into a single clean, comma-separated string. It strips duplicates, normalizes spacing, can sort, and hands you one tidy prompt you can wire straight into a CLIP Text Encode.

    You probably found it the same way everyone does: you ran WD14 Tagger on a few images (or tagger + your own manual additions), and instead of one prompt you got a jumble of overlapping tags. That's exactly the gap this fills. If you train LoRAs on anime models like Illustrious or NoobAI, the WD14 tagger output is your captioning pipeline - and this node is the "combine the crops" step that makes the output usable.

    The name is a lie, in a good way. "Marge" is just a misspelling of "Merge" that stuck in the class name and repo. The node doesn't call any API, needs no models, and has zero dependencies - the whole pack is one file of plain Python. It's the kind of utility that's so boring you forget it's installed, until you need it.

    What it actually does

    Behind the hood it's a four-step pipeline: it flattens whatever you feed it (it's declared INPUT_IS_LIST, so ComfyUI hands it the whole list instead of expanding it into parallel runs), splits each string on commas, strips and dedupes the tags, then rejoins them with your separator. The dedupe is case-insensitive by default, so Blonde_hair and blonde_hair collapse to whichever came first. Every repeated internal space gets squashed to one, but underscores - the currency of Danbooru-style prompting - are left alone.

    The inputs that matter

    Only four, and two of them are just toggles:

    • text - the tag list to merge. Wire the tagger's STRING-list output here. It's marked forceInput and multiline, so it's built to be connected, though you can paste text in too.
    • separator - what goes between tags. Default is , , which is what you want 99% of the time. Set it to | if your workflow builds booru-style prompts from segments.
    • sort_tags - alphabetical sort, handy when you're eyeballing a caption for gaps. The sort is case-insensitive.
    • case_sensitive - flip this to true if "Tag" and "tag" are genuinely different things in your project. For booru tagging, you almost never want this on.

    The single output, text, is a plain STRING - feed it into a CLIP Text Encode, a save-text node, or whatever consumes your final prompt.

    Installing it

    The README's official path is a plain clone:

    cd ComfyUI/custom_nodes
    git clone https://github.com/palealloy2999-prog/ComfyUI-marge-string-list.git
    

    Then restart ComfyUI. Easier still: if you run ComfyUI Manager, just search "ComfyUI-marge-string-list" and hit install. No requirements to pull, no model files to download - it works on a fresh install.

    Where people get burned

    The one real gotcha: it only splits on commas. Feed it a list where tags are separated by | or newlines, and the "dedupe" treats each whole string as a single tag - so tag_a | tag_b and tag_b | tag_c won't dedupe at all. If your tagger isn't outputting comma-separated tags, normalize them upstream first. Also remember dedupe is per node run: it merges everything in one pass, so two taggers on the same image collapse nicely, but if you chain two of these together the second one has nothing left to dedupe. It's a one-shot tool, and it's perfectly happy staying that way.

    Categorytext/tags

    Inputs (4)

    NameTypeDefaultDescription
    textSTRING
    separatorSTRING,
    sort_tagsBOOLEANfalse
    case_sensitiveBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    textSTRING