ComfyUI > Nodes > LF Nodes > Keyword counter

ComfyUI Node: Keyword counter

Class Name

LF_KeywordCounter

Category
✨ LF Nodes/Analysis
Author
lucafoscili (Account age: 2148days)
Extension
LF Nodes
Latest Updated
2024-10-15
Github Stars
0.03K

How to Install LF Nodes

Install this extension via the ComfyUI Manager by searching for LF Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter LF Nodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Keyword counter Description

Analyzes text prompts to count specified keywords for AI artists, enabling better input refinement and visualization.

Keyword counter:

The LF_KeywordCounter node is designed to analyze a given text prompt and count the occurrences of specified keywords. This node is particularly useful for AI artists who need to quantify the frequency of certain terms within their prompts, enabling them to better understand and refine their input for AI models. By splitting the prompt based on a defined separator, the node processes each keyword, normalizes it, and counts its occurrences. The results are then formatted into datasets suitable for visual representation in charts and chip sets, providing a clear and structured overview of keyword usage.

Keyword counter Input Parameters:

prompt

The prompt parameter is a multiline string input where you can enter the text containing the keywords you wish to count. This text will be analyzed by the node to identify and count the occurrences of each keyword. The prompt should be formatted according to the separator you choose, ensuring that keywords are correctly identified and counted. There is no minimum or maximum length for the prompt, but it should be structured in a way that the keywords are easily separable.

separator

The separator parameter is a string that defines the character(s) used to separate keywords within the prompt. By default, this is set to ", ", but you can customize it to any character or sequence of characters that best fits your prompt structure. The separator is crucial for correctly splitting the prompt into individual keywords, so it should be chosen carefully to match the format of your input text.

Keyword counter Output Parameters:

chart_dataset

The chart_dataset output is a JSON object formatted to be compatible with KulDataDataset for use in bar charts. This dataset contains the keyword counts, structured in a way that can be easily visualized, helping you to see the distribution and frequency of keywords in a graphical format. This output is particularly useful for creating visual representations of keyword usage.

chip_dataset

The chip_dataset output is a JSON object formatted for use in a chip set, which is a collection of keyword chips that can be used in various UI components. This dataset provides a structured list of the keywords identified in the prompt, allowing for easy integration into interfaces that require keyword selection or display.

Keyword counter Usage Tips:

  • Ensure that your prompt is well-structured and that keywords are clearly separated by the chosen separator to achieve accurate keyword counting.
  • Customize the separator to match the format of your prompt, especially if you are using special characters or sequences to separate keywords.
  • Use the chart_dataset output to create visual representations of keyword frequency, which can help in analyzing and refining your prompts.
  • Utilize the chip_dataset output for integrating keyword chips into your UI components, making it easier to manage and interact with the identified keywords.

Keyword counter Common Errors and Solutions:

"Invalid separator"

  • Explanation: The separator provided does not match the format of the prompt, leading to incorrect splitting of keywords.
  • Solution: Verify that the separator correctly matches the characters used to separate keywords in your prompt. Adjust the separator parameter to ensure it aligns with the prompt's structure.

"Empty prompt"

  • Explanation: The prompt provided is empty or only contains whitespace, resulting in no keywords to count.
  • Solution: Ensure that the prompt contains valid text with keywords separated by the chosen separator. Avoid using empty or whitespace-only prompts.

"Keyword count mismatch"

  • Explanation: The number of keywords identified does not match the expected count, possibly due to incorrect separator usage or formatting issues in the prompt.
  • Solution: Double-check the prompt for any formatting errors or inconsistencies. Ensure that the separator is correctly placed between keywords and that there are no extraneous characters affecting the keyword splitting process.

Keyword counter Related Nodes

Go back to the extension to check out more related nodes.
LF Nodes
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.