Visit ComfyUI Online for ready-to-use ComfyUI environment
Facilitates dynamic text prompt alteration by swapping specified words/phrases with alternatives for AI model input experimentation.
The PromptSwap node is designed to facilitate the dynamic alteration of text prompts by swapping specified words or phrases with alternatives. This node is particularly useful for AI artists who wish to experiment with different textual inputs to influence the output of AI models, such as those used in generative art or text-based applications. By allowing you to define target words and their corresponding replacements, PromptSwap provides a flexible mechanism to modify prompts without manually editing the text each time. This can be especially beneficial in scenarios where you want to quickly iterate over different variations of a prompt to see how they affect the generated results. The node's primary function is to identify and replace words or phrases in the input text based on a user-defined mapping, ensuring that the replacements are contextually appropriate and maintain the integrity of the original prompt's intent.
The text
parameter is the main body of text that you wish to modify. It serves as the input prompt where the specified target words will be searched and replaced with their corresponding exchange words. This parameter supports multiline input, allowing for complex and lengthy prompts to be processed. The content of this parameter directly influences the output, as it is the text that undergoes transformation based on the mappings provided in the other parameters.
The target_words
parameter is a string that contains the words or phrases you want to replace in the input text. These words are specified in a comma-separated format and can include phrases enclosed in quotes for more precise matching. The default value is "man, woman, \"no humans\""
, which indicates the initial set of words the node will look to replace. This parameter is crucial as it defines the elements in the text that are subject to change, and its configuration directly impacts which parts of the text will be altered.
The exchange_words
parameter is a string that lists the replacement words or phrases corresponding to each target word. Like target_words
, this parameter uses a comma-separated format and can include quoted phrases. The default value is "woman, man, \"many monsters\""
, which provides the initial set of replacements for the target words. The order of words in this parameter should match the order in target_words
, as each word or phrase in exchange_words
is mapped to the corresponding entry in target_words
. This parameter determines the new content that will replace the target words in the text.
The output parameter is a STRING
that represents the modified version of the input text after the specified word swaps have been applied. This output is crucial as it reflects the changes made to the original prompt, showcasing the effect of the word replacements. The modified text can then be used as input for further processing or as a final output, depending on your needs. The output's accuracy and relevance are directly tied to the correct configuration of the input parameters.
target_words
and exchange_words
are correctly paired and that each target word has a corresponding exchange word.target_words
and exchange_words
to handle multi-word replacements effectively, ensuring that the entire phrase is treated as a single unit during the swap.target_words
and exchange_words
parameters.RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.