ComfyUI > Nodes > WAS Node Suite > Text Compare

ComfyUI Node: Text Compare

Class Name

Text Compare

Category
WAS Suite/Text/Search
Author
WASasquatch (Account age: 4688days)
Extension
WAS Node Suite
Latest Updated
2024-08-25
Github Stars
1.07K

How to Install WAS Node Suite

Install this extension via the ComfyUI Manager by searching for WAS Node Suite
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter WAS Node Suite 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

Text Compare Description

Automate text comparison with flexible settings for similarity or difference modes, providing detailed results for analysis.

Text Compare:

The Text Compare node is designed to help you analyze and compare two text strings to determine their similarity or differences. This node is particularly useful for tasks that require text validation, content matching, or identifying variations between two pieces of text. By leveraging this node, you can automate the process of text comparison, which can be beneficial in various applications such as content creation, data validation, and quality assurance. The node provides a flexible approach to comparison by allowing you to choose between similarity and difference modes, and it also offers a tolerance setting to fine-tune the sensitivity of the comparison. The results include a boolean indicating if the texts are identical, a similarity score, and a detailed comparison text highlighting the differences or similarities.

Text Compare Input Parameters:

text_a

This parameter represents the first text string to be compared. It is a required input and should be provided as a string. The comparison process will use this text as one of the two primary inputs.

text_b

This parameter represents the second text string to be compared. Similar to text_a, it is a required input and should be provided as a string. The comparison process will use this text as the other primary input.

mode

This parameter allows you to choose the mode of comparison. It accepts two options: "similarity" and "difference". The "similarity" mode focuses on how similar the two texts are, while the "difference" mode highlights the differences between them. This setting helps tailor the comparison to your specific needs.

tolerance

This parameter sets the tolerance level for the comparison. It is a floating-point number with a default value of 0.0, a minimum value of 0.0, and a maximum value of 1.0. The tolerance level adjusts the sensitivity of the comparison, with lower values making the comparison stricter and higher values allowing for more leniency.

Text Compare Output Parameters:

TEXT_A_PASS

This output returns the original text_a input. It is useful for reference and validation purposes, ensuring you can easily trace back the input text.

TEXT_B_PASS

This output returns the original text_b input. Similar to TEXT_A_PASS, it helps in referencing and validating the input text.

BOOLEAN

This output is a boolean value indicating whether the two texts are identical. A value of true means the texts are exactly the same, while false indicates they are different.

SCORE_NUMBER

This output provides a numerical score representing the similarity or difference between the two texts. The score is a floating-point number, with higher values indicating greater similarity (in similarity mode) or greater difference (in difference mode).

COMPARISON_TEXT

This output is a text string that provides a detailed comparison of the two input texts. In similarity mode, it highlights the commonalities, while in difference mode, it emphasizes the differences. This output is particularly useful for understanding the specific areas where the texts match or diverge.

Text Compare Usage Tips:

  • Use the mode parameter to switch between similarity and difference analysis based on your specific needs. For instance, use similarity mode for content matching and difference mode for identifying changes or discrepancies.
  • Adjust the tolerance parameter to fine-tune the comparison sensitivity. A lower tolerance is ideal for strict comparisons, while a higher tolerance can be useful when minor differences are acceptable.
  • Utilize the COMPARISON_TEXT output to get a detailed view of the comparison results, which can help in understanding the specific areas of similarity or difference between the texts.

Text Compare Common Errors and Solutions:

"Input text cannot be empty"

  • Explanation: This error occurs when one or both of the input text parameters (text_a or text_b) are empty.
  • Solution: Ensure that both text_a and text_b are provided with valid text strings before executing the node.

"Invalid mode selected"

  • Explanation: This error occurs when an invalid value is provided for the mode parameter.
  • Solution: Make sure to select either "similarity" or "difference" for the mode parameter to avoid this error.

"Tolerance value out of range"

  • Explanation: This error occurs when the tolerance parameter is set to a value outside the allowed range (0.0 to 1.0).
  • Solution: Adjust the tolerance parameter to a value within the range of 0.0 to 1.0 to resolve this issue.

Text Compare Related Nodes

Go back to the extension to check out more related nodes.
WAS Node Suite
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.