Nodes/Prompt Palette-F/Get First Word (List)
ComfyUI Node

Get First Word (List)

The list version of Get First Word — for when you have a whole batch of prompts

By id-fa·Created about a year ago·Updated 8 days ago· 2
Get First Word (List)
    • text
    • list
    stop_word,
    use_regexfalse
    trimtrue
    remove_invalid_filename_charsfalse
    add_trailing_slashfalse
    text_separator,
    items

    Get First Word (List) is exactly what the name promises: the same "cut before the first stop word" transform as GetFirstWord, but applied to every element of a list instead of a single string. It's the sibling you reach for when you're not slicing one prompt - you're slicing dozens, and you want all the results back in one go.

    The intended pairing is with the selected_list output of this pack's PromptPalette-F node. That node hands you the list of phrases you've checked, and this one turns each phrase into its first word. If your palette is built so that every phrase starts with a subject tag, you get a clean list of subjects in one pass - ready to drive filenames, folder names, or batch processing downstream.

    The inputs

    Everything that GetFirstWord has, plus one:

    • items - the list to process. Wire-only, feeds from any LIST output (like PromptPalette_F.selected_list).
    • stop_word, use_regex, trim, remove_invalid_filename_chars, add_trailing_slash - identical to the single-string version, applied per element. Defaults match: stop_word is ,, trim on, the filename toggles off.
    • text_separator - how the per-element results get joined in the text output (default , ). Does not affect the list output.

    The outputs

    Two of them, and they're meaningfully different:

    • text - all the processed results joined with text_separator. A flat string, ready to feed a filename or a text encoder.
    • list - the raw processed results as a list, untouched by the separator. This is the one you want if you're looping or mapping over the results rather than concatenating.

    That split is the whole reason the node exists: one output for "glue this together," one for "keep the structure."

    Installing it

    It's part of the PromptPalette-F pack, so:

    cd ComfyUI/custom_nodes
    git clone https://github.com/id-fa/ComfyUI-PromptPalette-F prompt-palette-f
    cd prompt-palette-f
    pip install -r requirements.txt
    

    Restart, look under Prompt Palette-F. Or ComfyUI Manager → search "Prompt Palette-F" (you may get a slightly older snapshot). No models, no heavy deps - the pack's only pip dependency is googletrans, which this node doesn't touch.

    The one trap

    The list output doesn't re-apply the separator, which is the behavior you want - but don't confuse the two outputs when you're wiring things up. Also remember the same gotcha as the single version: it cuts at the first occurrence of the stop word, and a regex stop word that fails just passes each element through whole. If a phrase doesn't contain your delimiter at all, you get the whole phrase back. For the "extract subject from a batch of checked phrases" workflow, that's usually exactly right, and it's a lot less plumbing than a loop of single-string nodes.

    CategoryPrompt Palette-F

    Inputs (7)

    NameTypeDefaultDescription
    stop_wordSTRING,
    use_regexBOOLEANfalse
    trimBOOLEANtrue
    remove_invalid_filename_charsBOOLEANfalse
    add_trailing_slashBOOLEANfalse
    text_separatorSTRING,
    itemsoptSTRING

    Outputs (2)

    NameTypeDescription
    textSTRING
    listSTRING