🐧随机提示词行提取@炮老师的小课堂:
The DapaoRandomPromptLineExtractNode is a versatile tool designed to extract random lines from a given multiline text input. This node is particularly useful for AI artists who work with large sets of prompt lines and need to randomly select a subset for creative purposes. The node allows you to specify the number of lines to extract and provides options for preprocessing the text, such as converting to uppercase, removing punctuation, or extracting only numeric characters. By leveraging a random seed, the node ensures reproducibility of results, making it a reliable component in workflows that require consistent outputs. Its primary goal is to streamline the process of handling and manipulating text data, offering a range of preprocessing options to tailor the output to specific needs.
🐧随机提示词行提取@炮老师的小课堂 Input Parameters:
📝 多行文本
This parameter accepts a multiline string input where each line represents a candidate prompt. It serves as the source from which random lines will be extracted. The default value is an empty string, and it supports multiline input to accommodate extensive prompt lists.
🧰 字符串预处理
This parameter allows you to specify how the text should be preprocessed before extraction. Options include "不改变" (no change), "取数字" (extract numbers), "取字母" (extract letters), "转大写" (convert to uppercase), "转小写" (convert to lowercase), "取中文" (extract Chinese characters), "去标点" (remove punctuation), "去换行" (remove newlines), "去空行" (remove empty lines), "去空格" (remove spaces), "去格式" (normalize formatting), and "统计字数" (count characters). The default option is "不改变".
🔢 提取行数
This integer parameter determines the number of lines to extract from the input text. It ranges from 1 to 9999, with a default value of 1. This allows you to control the volume of extracted data based on your specific requirements.
🎲 随机种子
The random seed parameter is an integer that influences the randomness of line selection. It ranges from 0 to 0x7FFFFFFF, with a default value of 0. Setting a specific seed ensures that the same lines are extracted in repeated runs, providing consistency in outputs.
🐧随机提示词行提取@炮老师的小课堂 Output Parameters:
📝 提取结果
This output provides the extracted lines as a list of strings. The lines are selected based on the specified number of lines to extract and any preprocessing options applied. This output is crucial for generating varied and creative prompts from a larger dataset.
🔢 字数
This integer output represents the total number of non-space characters in the extracted lines. It is particularly useful when the "统计字数" preprocessing option is selected, providing a quick count of characters for further analysis or constraints.
🐧随机提示词行提取@炮老师的小课堂 Usage Tips:
- To ensure consistent results across different runs, set a specific value for the random seed parameter.
- Use the preprocessing options to tailor the extracted text to your needs, such as removing punctuation for cleaner outputs or converting text to uppercase for emphasis.
- When working with large datasets, consider extracting a smaller number of lines to maintain focus and manageability.
🐧随机提示词行提取@炮老师的小课堂 Common Errors and Solutions:
Empty Input Text
- Explanation: This error occurs when the input text is empty or contains only whitespace.
- Solution: Ensure that the input text parameter contains valid lines of text before running the node.
Invalid Pick Count
- Explanation: This error arises when the specified number of lines to extract exceeds the number of available lines in the input.
- Solution: Adjust the pick count to be less than or equal to the number of lines in the input text.
Unsupported Preprocessing Option
- Explanation: This error happens if an invalid preprocessing option is selected.
- Solution: Verify that the preprocessing option is one of the supported choices listed in the input parameters.
