TagSelector
Pick tags by category with a whitelist, a blacklist, and a fuzzy filter
- result
- found
TagSelector is the sibling of TagFilter that replaces the nine checkboxes with one text field and one boolean. Where TagFilter has a fixed list of clickable categories, this node lets you type any category name, comma-separated, and get either "only these categories" or "everything except these categories." Same bundled category lookup, same normalized tag matching, just more flexible - and it adds two flags the filter doesn't have.
If you're building a reusable workflow, TagSelector tends to age better than TagFilter because the category set lives in a string you can drive from elsewhere instead of being baked into node defaults.
The inputs that matter
- tags - your comma-separated tag string, typically straight off a WD14Tagger or similar.
- categorys - comma-separated category names. Defaults to
*, which means "all categorized tags." - exclude - flips the meaning.
Falsekeeps only the named categories;Truekeeps everything except them. - whitelist_only - when on, any tag that isn't in the category file at all gets dropped. Off by default, which means unknown tags pass through untouched. This is your "is this tag even known?" gate.
- flexible_filter - the standout. When a tag isn't in the category file, this tries dropping leading words to find a known tag underneath.
That last one deserves an example, straight from the author. Say your tagger emits crasy long hair - a typo'd mess that's not in any category file. With flexible_filter on, the node keeps peeling off the first word (long hair) until it finds a known tag, then classifies it as hair_style. The unknown text still passes through as a tag; what changes is that it now counts as a known category and can be selected or excluded by category.
Outputs
Two, and both are useful:
- result (STRING) - the filtered tag string.
- found (BOOLEAN) - whether anything survived. Great for gating downstream nodes, or for spotting the "I filtered everything away" failure before it silently ruins a batch.
The two ways this bites you
The category name has to match the file's spelling. Spaces become underscores (hair style → hair_style) and it lowercases, but if you invent a category that doesn't exist in tag_category_v3.json, you'll match nothing. Check the file if you're unsure a category exists.
And flexible_filter only rescues tags where the known tag is the tail - crasy long hair works because long hair is the suffix. A tag where the garbage is in the middle won't be recovered. It's a fuzzy nudge, not a real spell-checker.
Install and quirks
Same as 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 model files - the category data ships with the repo. One shared-pack gotcha: the category files are AI-sorted and best-effort, so a tag can be in the wrong category and no amount of flag-toggling fixes that; you just pick a different node or hand-tune the string.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| tags | STRING | — | |
| categorys | STRING | * | — |
| exclude | BOOLEAN | false | — |
| whitelist_only | BOOLEAN | false | — |
| flexible_filter | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| result | STRING | — |
| found | BOOLEAN | — |