Nodes/Mayo Nodes/Mayo Text Formatter
ComfyUI Node

Mayo Text Formatter

Tame danbooru tags and messy text without touching a model

By Pasu2k·Created 5 months ago·Updated 2 months ago· 0
Mayo Text Formatter
    • string
    text
    replace_underscores_with_spacesfalse
    everything_lowercasefalse

    Mayo Text Formatter is a three-toggle string cleanup node: text in, cleaned text out, no models involved. It exists because prompt text in the wild arrives in a few annoying shapes - underscore-joined danbooru tags from a WD tagger, or comma-tight pastes like 1girl,blue_eyes - and none of it is what you want to feed downstream.

    Why you'd reach for it

    If you work with the anime SDXL family (Illustrious, Noob, anything trained on danbooru captions), you live in that vocabulary: danbooru's tag taxonomy is effectively the prompting language of the whole anime ecosystem, and taggers emit it underscore-joined - 1girl_blue_eyes_white_hair. This node is for when you want that string cleaned up for human eyes, or normalized before it goes somewhere picky. It's also handy if you save generated prompts or tag lists as filenames and want them readable.

    How it works

    Three transforms, applied in a fixed order in the source:

    1. A regex adds a space after every comma, unless a space or underscore already follows it - so tag1,tag2 becomes tag1, tag2 without double-spacing tag1, tag2.
    2. replace_underscores_with_spaces swaps _ for a space.
    3. everything_lowercase lowercases the whole string.

    The inputs

    • text - multiline, paste anything.
    • replace_underscores_with_spaces - boolean.
    • everything_lowercase - boolean.

    Output is a single string, which you wire into CLIP Text Encode, a Save Text node, or anything else that eats a STRING.

    The gotcha that actually matters

    Here's where people get burned: for models trained on danbooru captions, blue_hair with the underscore is what the model learned. Swap it to "blue hair" and the CLIP tokenizer splits it into separate tokens the model never saw joined that way - tags often read weaker. So the underscore toggle is really for human-readable output (filenames, notes, storing a clean tag list), not for feeding back into an anime model's prompt. Keep the underscores if the target model was trained on them.

    Similarly, everything_lowercase is a blunt instrument. It flattens proper nouns too - Satsuki becomes satsuki - which breaks case-sensitive tags and character names. If all you want is consistency, the comma-spacing fix alone is the safe one; it's basically always harmless.

    Installing it

    Search "Mayo Nodes" in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Pasu2k/comfyui-mayo-nodes
    

    Then restart ComfyUI. No dependencies, no model files - the pack is pure Python standard library, which means nothing to pip install and nothing to fight.

    It's a tiny utility from a small personal pack, and the moment you're staring at a wall of 1girl_red_eyes_white_hair_solo and want it to read like a sentence, you'll be glad it exists.

    CategoryMayoNodes

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    replace_underscores_with_spacesBOOLEANfalse
    everything_lowercaseBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    stringSTRING