ComfyUI Node

Modify Text Gender

Rewriting a description toward male or female automatically

By zhangp365·Created 2 years ago·Updated 5 months ago· 134
Modify Text Gender
    • STRING
    gender_prior
    text
    gender_prior_weight1.0
    gender_alternative
    enabledtrue

    This one has the highest click-through of any node in this pack relative to its impressions, which tracks - it's solving a specific, recurring annoyance in caption and prompt pipelines: you have one description and want it to work for both a male and female subject, without hand-editing pronouns and gendered nouns every single time.

    What it does

    Feed it a text string and a gender_prior - "", M, or F - and it rewrites the text to match: set to M, it adjusts the description toward male; set to F, toward female, per the author's own framing. It's part of a small family of gender-aware nodes in this pack - the README also documents GenderControlOutput (outputs different text/float/int values depending on a gender input) and a Gemini-based prompt enhancer that takes the same kind of gender signal - so this is clearly a piece the author built for a specific class of workflow: batch captioning or LoRA-training dataset prep where the same base description needs to serve multiple subjects consistently.

    The fields that matter

    • gender_prior - required, ""/M/F. This drives the rewrite direction. Leaving it blank is a real, supported choice in the dropdown, not just an unset default.
    • text - required, the description you're modifying.
    • gender_prior_weight (optional, 0–3, default 1) - a strength knob for how firmly the rewrite leans into the chosen gender. Start at the default and adjust from there rather than guessing at either extreme first.
    • gender_alternative (optional string) - a secondary text input alongside the blank option on gender_prior. This pack leans on a "primary input, with a fallback for the empty case" pattern elsewhere too (see TextInputAutoSelector), so treat gender_alternative the same way: something to have ready for the case where gender_prior isn't set to M or F.
    • enabled (optional, default true) - the same disable-in-place toggle used across this pack's other utility nodes.

    Output: a single STRING.

    Installing it

    ComfyUI Manager: search "ComfyUI-utils-nodes." Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/zhangp365/ComfyUI-utils-nodes
    

    Restart ComfyUI. No external dependencies, no models - this is a text-rewriting node, not a captioning model itself.

    Where to be careful

    Automated gender-rewriting on free-form text is inherently a best-effort transform, not a guaranteed-correct one - always spot-check a sample of the output before trusting it across a whole dataset or a large batch run, especially at the extremes of gender_prior_weight, where a heavier-handed rewrite has more room to mangle a sentence than a light one does. If your text comes back barely changed, try nudging the weight up before assuming the node isn't working - at the low end, a light touch might not be doing enough to notice on short descriptions.

    Categoryutils/text

    Inputs (5)

    NameTypeDefaultDescription
    gender_priorCOMBO3 options: , M, F
    textSTRING
    gender_prior_weightoptFLOAT1.00–3
    gender_alternativeoptSTRING
    enabledoptBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    STRINGSTRING