Nodes/ComfyUI-bby-nodes/Tag Filter (from list)
ComfyUI Node

Tag Filter (from list)

Does your prompt actually contain the tags you think it does? This node answers in two outputs

By Eonizer·Created 6 months ago·Updated 6 months ago· 0
Tag Filter (from list)
    • filtered_tags
    • missing_tags
    tag_list
    input_tags
    match_mode
    case_sensitivefalse
    strip_underscorestrue

    Ever look at a prompt and realize you have no idea whether the quality tags you spent twenty minutes assembling actually made it in? If you're on an SDXL-lineage model - Pony, Illustrious, NoobAI, the lot - those tags are doing real work. score_9, score_8_up on Pony, masterpiece, best quality on Illustrious: they earn their place. This node is the two-second way to prove they're there, or find out they're not.

    Tag Filter (from list) is a tiny pure-Python node from the bby-nodes pack. It takes one list of tags you care about (your reference list) and one list of tags to check (your actual prompt), and it tells you which ones matched and which ones went missing. It's the diff you keep re-reading your prompt to compute by eye.

    How it works

    The mechanism is boring, which is exactly why it's reliable. Both inputs get split on newlines and commas, so you can paste a prompt with 1girl, long hair, red dress or a quality list one-per-line - either works. Each reference tag is normalized (lowercased and underscores turned into spaces, unless you disable those toggles) and deduplicated, first occurrence wins.

    Then it runs one of two modes, from the author's own description:

    • exact - the tag must match a reference tag outright. looking at viewer matches looking at viewer, nothing else.
    • partial - a reference tag found inside an input tag counts as a hit. looking at viewer inside woman looking at viewer matches - and notably, the node returns the reference (canonical, shorter) form, not the longer input tag.

    Where people get tripped up: partial mode isn't a substring sanity check per input - an input tag can match multiple reference tags, and all of them come back (deduplicated). And it's pure membership testing. There's no wildcard syntax, no regex, no glob. Don't go looking for *horns*; you'll be disappointed.

    The inputs and outputs that matter

    You set five things, and only three of them really need your attention:

    • tag_list - your reference list: the tags you want to verify or extract.
    • input_tags - the thing being checked: your actual prompt.
    • match_mode - exact or partial (default exact).
    • case_sensitive (default off) and strip_underscores (default on) - leave both alone unless you know why you're touching them. Booru tags use underscores but models are trained on spaces, so the default normalize-on is the right call.

    The two outputs are both plain comma-joined strings (not lists), which is handy: filtered_tags and missing_tags each wire straight into a CLIPTextEncode text input or a text-concat node. The classic workflow is to route missing_tags back into a concatenate and append whatever quality tag the check revealed was absent. Lazy, automatic, done.

    Installing it

    No dependencies, no model downloads, no wheels - this is a single-file utility, so install is the boring two-liner:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Eonizer/ComfyUI-bby-nodes
    

    Restart ComfyUI and you'll find it under the bbyNodes category in the node menu. Or just search "ComfyUI-bby-nodes" in ComfyUI Manager and hit Install. That's the whole install story; there is no second act.

    Common issues

    • Nothing matches and you're sure it should. Check case_sensitive and strip_underscores. If you pasted a reference with underscores and the input uses spaces, and you flipped the toggle, that's your answer.
    • Partial mode gives you short tags you didn't paste. That's the canonical-form behavior above, not a bug. If you need the original wording back, use exact mode.
    • You expected a list, got one big string. Outputs are comma-joined; most text inputs (including CLIPTextEncode) are happy with that, but a node expecting a list of tags won't be.

    It's not the node you'll build a workflow around - it's the one that quietly saves you from shipping a batch where your quality tags got stripped somewhere upstream. For that job, it's exactly right.

    CategorybbyNodes

    Inputs (5)

    NameTypeDefaultDescription
    tag_listSTRING
    input_tagsSTRING
    match_modeCOMBO2 options: exact, partial
    case_sensitiveBOOLEANfalse
    strip_underscoresBOOLEANtrue

    Outputs (2)

    NameTypeDescription
    filtered_tagsSTRING
    missing_tagsSTRING