-
Notifications
You must be signed in to change notification settings - Fork 0
/
p250.py
78 lines (69 loc) · 3.04 KB
/
p250.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import random
# Define movie genres and example templates
genres = [
"action",
"adventure",
"animation",
"biography",
"comedy",
"crime",
"drama",
"family",
"fantasy",
"history",
"horror",
"music",
"musical",
"mystery",
"romance",
"sci-fi",
"sport",
"thriller",
"war",
"western"
]
templates = [
"Something thrilling with fights, chases, and explosions. I like stunts. Violence and gore.",
"I'm in the mood for a treasure hunt or quest, maybe with pirates and epic heroes and villains.",
"I watch cartoons and anime. My children love wholesome educational artwork.",
"Something inspiring. About life. Biopic. True story and real life.",
"Something hilarious and crude. So so funny and lighthearted. Filled with utter joy. Satirical and witty.",
"Mysterious, Sherlock Holmes. Murder mystery. Tragedy, dark. A whodunnit, similar to Agatha Christie.",
"A true story or similar to real life. Sad and heavy. About love, life, and loss.",
"Something I can watch with my kids, age-appropriate. Funny, animated. Disney perhaps.",
"I like dragons and ogres and folklore. The supernatural like ghosts and zombies and witches. Imagination, unreal.",
"Something that has happened, low key, low budget, artistic.",
"Supernatural, psychological, thrilling, on the edge of my seat, terrifying. Apocalyptic.",
"Fun. Dance numbers, jazzy. Singing.",
"Dancing and singing.",
"Agatha Christie, Sherlock Holmes. Piecing together clues. Plot twist. Murder.",
"Predictable hallmark, sentimental. Emotional tragedy, personal journey. Care Hope. Queer, gay.",
"Time travel teleportation, telepathy and aliens. Star wars. Fantastic, dystopian.",
"Baseball, football, Olympics, competition. Underdog protagonist.",
"I want to be sweating at the edge of my seat. Anxious and uncertain and surprise.",
"Violence destruction mortality. Life and death and the moments in between. Uncertainty, legality, and ethics.",
"America, small towns, saloons. Outlaws and bandits. Horse, cowboy.",
"Heart-pounding and charged. Like a superhero movie."
]
# Generate examples
examples = []
examples_per_label = 5
total_examples = 250
# Create a dictionary to keep track of used examples for each genre
used_examples = {genre: [] for genre in genres}
while len(examples) < total_examples:
genre = random.choice(genres)
if len(used_examples[genre]) < examples_per_label:
example = random.choice(templates)
if example not in used_examples[genre]:
used_examples[genre].append(example)
examples.append((example, genre))
# Shuffle the examples to make them random
random.shuffle(examples)
# Save the examples to a CSV file
import csv
with open("movie_examples.csv", mode="w", newline="") as file:
writer = csv.writer(file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
for example in examples:
writer.writerow(example)
print(f"CSV file 'movie_examples.csv' has been created with {total_examples} unique examples.")