Update DataSet_ConceptManager.py

added a # to remove tags to all remove tags from everywhere in text in case someone needs it
This commit is contained in:
Daxton Caylor
2025-03-01 10:54:50 +05:30
committed by GitHub
parent 55d3bbd42c
commit 83a3c7254c
+10 -5
View File
@@ -42,21 +42,26 @@ def getWords(combined_texts, split):
return joined_words
def remove_text(tags, combined_texts):
tags_list = [tag.strip() for tag in tags.split(',')]
text_pos_list = [text_pos.strip().split()
for text_pos in combined_texts.split(',')]
text_pos_list = [text_pos.strip().split() for text_pos in combined_texts.split(',')]
for text_pos in text_pos_list:
num_pos = len(text_pos) - 1
text = " ".join(text_pos[0:num_pos])
if text in tags_list:
tags_list.remove(text)
pos_str = text_pos[num_pos]
if pos_str == "#": # Remove all instances of the text
tags_list = [tag for tag in tags_list if tag != text]
else:
if text in tags_list:
tags_list.remove(text) # Remove only one instance
new_tags = ', '.join(tags_list)
return new_tags
class DataSet_ConceptManager:
def __init__(self):