poem_analysis / utils.py
esocoder's picture
first commit
996aa19
raw
history blame
1.17 kB
import os
def read_poems_from_directory(directory):
poems = []
seen_files = set()
for filename in os.listdir(directory):
if filename.endswith(".txt") and filename not in seen_files:
seen_files.add(filename)
with open(os.path.join(directory, filename), 'r') as file:
poems.append(file.read())
return poems
emotion_labels_with_colors = {
"happiness": "yellow",
"sadness": "blue",
"anger": "red",
"fear": "purple",
"disgust": "green",
"surprise": "orange",
"love": "pink",
"joy": "gold",
"anxiety": "lightblue",
"contentment": "lightgreen",
"frustration": "brown",
"loneliness": "grey",
"excitement": "cyan",
"guilt": "darkred",
"shame": "darkblue",
"envy": "darkgreen",
"jealousy": "olive",
"pride": "magenta",
"gratitude": "lavender",
"empathy": "peachpuff",
"compassion": "coral",
"boredom": "beige",
"relief": "lightyellow",
"curiosity": "lightcoral",
"awe": "turquoise",
"confusion": "plum",
"nostalgia": "orchid",
"hope": "khaki",
"despair": "maroon",
"embarrassment": "salmon"
}