Text Choice Parser [LP]| Text Choice Parser [LP]:
The TextChoiceParser| Text Choice Parser [LP] node is designed to facilitate dynamic text generation by allowing you to parse and manipulate text strings with embedded choices and variables. This node is particularly useful for creating varied and customizable text outputs, which can be beneficial in creative applications such as AI art descriptions or narrative generation. By leveraging a combination of predefined variables and random choice selections within the text, the node enables you to produce diverse outputs from a single input template. This flexibility can enhance the creative process by introducing variability and adaptability in text-based content.
Text Choice Parser [LP]| Text Choice Parser [LP] Input Parameters:
text
The text parameter is a required input that accepts a string, which can be multiline. This string serves as the template for text generation, where you can embed variables and choice patterns. The text can include placeholders for variables in the format [variable_name] and choice patterns in the format {option1|option2|...}. The node will replace these placeholders with the corresponding values or randomly selected options. There is no explicit minimum or maximum value for the text length, but it should not exceed 10,000 characters to ensure efficient processing.
variables
The variables parameter is an optional input that also accepts a multiline string. This string should contain key-value pairs, where each line represents a variable assignment in the format key=value. These variables are used to replace corresponding placeholders in the text parameter. If no variables are provided, the node will skip the variable replacement step. This parameter allows you to customize the text output by dynamically inserting specific values.
seed
The seed parameter is an optional integer input that influences the randomness of choice selections within the text. By default, it is set to 0, which means the node will use the current time in milliseconds as the seed, ensuring different outputs on each execution. You can specify a fixed seed value to produce consistent and repeatable results. The seed value must be a non-negative integer, with a maximum value of 0xffffffffffffffff.
Text Choice Parser [LP]| Text Choice Parser [LP] Output Parameters:
text
The text output parameter returns a string that represents the processed version of the input text. This output includes all variable replacements and randomly selected choices, resulting in a customized and potentially varied text output. The output is crucial for applications that require dynamic text generation, as it provides the final, user-defined content ready for use in further processing or display.
Text Choice Parser [LP]| Text Choice Parser [LP] Usage Tips:
- To ensure consistent results across multiple runs, specify a fixed seed value. This is particularly useful when you need reproducible outputs for testing or iterative design processes.
- Use the
variablesparameter to manage and update text content dynamically without altering the main text template. This approach can streamline the process of generating multiple variations of a text.
Text Choice Parser [LP]| Text Choice Parser [LP] Common Errors and Solutions:
"Text too large to process at once"
- Explanation: This error occurs when the input text exceeds the maximum allowed length of 10,000 characters.
- Solution: Reduce the size of the input text by breaking it into smaller segments or simplifying the content to fit within the character limit.
"Variable not found"
- Explanation: This error might occur if a placeholder in the text does not have a corresponding variable defined in the
variablesparameter. - Solution: Ensure that all placeholders in the text have matching key-value pairs in the
variablesinput. Double-check for any typos or missing entries.
