ComfyUI Node

TagMerger4

Merge four tag streams into one deduplicated string

By sugarkwork·Created 2 years ago·Updated 6 months ago· 89
TagMerger4
    • result
    tags1
    tags2
    tags3
    tags4
    under_scoretrue

    TagMerger4 is the four-input version of TagMerger. Same job - combine tag strings, drop duplicates, output one clean comma-separated result - just with tags1 through tags4 instead of two. All four inputs are optional, so it degrades gracefully: wire up two and you've basically got TagMerger; wire up four and you're combining a tagger's output, a character set, a style set, and a random extras set in one shot.

    The point of the multi-input version over chaining two-input merges is the dedupe happens across the entire set in one pass, in one place. Chain three TagMergers and the result is identical mathematically, but the graph gets tall, and you're debugging three nodes instead of one when a tag goes missing.

    What you get

    • result output: the merged, deduplicated tag string. Order follows input order - first occurrence wins, duplicates skipped, emphasis weights carried through via the pack's shared parser.
    • under_score toggle (default on): spaces to underscores in the output. On by default because the pack's category matching normalizes to underscores anyway.

    For most people the interesting behavior is exactly one thing: a tag that appears in two of the four inputs appears exactly once in the output. When you're feeding several overlapping tag sets into a prompt, that single fact keeps the final string from being half duplicates.

    The variant trap

    TagMerger4 is a good reminder that this pack ships an embarrassingly complete merger family - TagMerger (2 inputs), TagMerger4 (4), and TagMerger6 (6). There's nothing magical separating them; they're the same parse_tagsremove_duplicatestagdata_to_string pipeline with more ports. Pick the one whose input count matches your actual number of streams. The only real downside of reaching for TagMerger6 when you have five streams is a slightly wider node; there's no performance hit worth caring about.

    Install

    Identical to the rest of the pack: ComfyUI Manager search "comfyui_tag_filter", or

    cd ComfyUI/custom_nodes
    git clone https://github.com/sugarkwork/comfyui_tag_fillter
    

    Restart, done. No dependencies, no models. If you're new to the pack, this is a genuinely safe first node - it can't fail on category data (it doesn't use any) and it can't produce a prompt-breaking result (at worst it's a text concat with extra steps).

    Categorytext

    Inputs (5)

    NameTypeDefaultDescription
    tags1optSTRING
    tags2optSTRING
    tags3optSTRING
    tags4optSTRING
    under_scoreoptBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    resultSTRING