-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
73 lines (59 loc) · 2.18 KB
/
main.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
import random
all_characters = {"Willy", "Fast", "Bottom", "Giuletta", "Richard", "Lady Beth",
"Le juriste", "Le clergyman", "Le scientifique", "Le psychiatre", "Le mondain",
"Didascalie"}
def check_scene(scene_number):
print(f"scene {scene_number}")
with open(f"transcriptions/scene_{scene_number}.txt") as f:
file_lines = [line.strip() for line in f.readlines()]
theatrical_lines = []
new_character = True
for file_line in file_lines:
if not file_line:
new_character = True
elif file_line[0] != "#":
if new_character:
theatrical_lines.append({"character": file_line, "lines": []})
new_character = False
else:
theatrical_lines[-1]["lines"].append(file_line)
characters = set([plop["character"] for plop in theatrical_lines])
print(f"Characters : {characters}")
assert characters.issubset(all_characters)
# while True:
# chosen_character = input("Choose character : ")
# if chosen_character not in characters:
# print(f"{chosen_character} is not available.")
# else:
# break
#
# totos = [(i, j)
# for i, plop in enumerate(theatrical_lines) if plop["character"] == chosen_character
# for j, line in enumerate(plop["lines"])]
# while True:
# input("\nAppuie sur Enter pour un nouveau test...")
#
# i, j = random.choice(totos)
#
# if i > 0:
# plop = theatrical_lines[i-1]
# print("**", plop["character"], "**")
# lines = plop["lines"]
# if len(lines) > 3:
# lines = ["[...]"] + lines[-3:]
# print(*lines, sep="\n")
#
# plop = theatrical_lines[i]
# print("**", plop["character"], "**")
# print(*plop["lines"][:j], sep="\n")
#
# input("Appuie sur Enter pour vérifier ce qui vient ensuite...")
#
# print(plop["lines"][j])
def main():
for scene_number in range(1, 20):
# if scene_number == 4:
# continue
check_scene(scene_number)
if __name__ == '__main__':
main()