exact_keyword algorithm is updated

This commit is contained in:
alpertunga-bile
2023-07-21 13:58:19 +00:00
committed by GitHub
parent b8910a2863
commit 5f01ef379a
+4 -2
View File
@@ -93,6 +93,7 @@ class PromptGenerator:
prompts = self.GetUniqueList(line.split(","))
pure_prompts = []
"""
def GetCanAdd(given_substring : str, original_string : str) -> bool:
if len(given_substring) > len(original_string):
if original_string in given_substring:
@@ -102,6 +103,7 @@ class PromptGenerator:
return False
return True
"""
# remove exact keyword
for prompt in prompts:
@@ -118,7 +120,7 @@ class PromptGenerator:
break
extracted_pure_prompt = "".join(c for c in pure_prompt if c not in char_blacklist)
if GetCanAdd(keyword, extracted_pure_prompt) is False:
if keyword in extracted_pure_prompt or keyword == extracted_pure_prompt:
can_add = False
break
@@ -234,4 +236,4 @@ NODE_CLASS_MAPPINGS = {
# A dictionary that contains the friendly/humanly readable titles for the nodes
NODE_DISPLAY_NAME_MAPPINGS = {
"Prompt Generator": "Prompt Generator"
}
}