/
high_level.txt
executable file
·61 lines (39 loc) · 2.04 KB
/
high_level.txt
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
dom = parse(play)
speaker_count = Counter()
#This will keep a track of how many lines each character has in the act
#and stores it in the form (Characters_Name: number_of_lines)
count_lines_for_each_speaker(dom, speaker_count)
#create an empty list
actors_scene = {}
get_list_of_speakers_each_scene(dom, actors_scene)
#actors_scene now holds information about all the characters in each scene that speak
#in the form {ACT I SCENE I': set(['HORATIO', 'FRANCISCO', 'BERNARDO'])}
#create an empty graph to draw our network on
graph = pydot.Dot(graph_type='graph',overlap=False)
#for every person who speaks, we are going to need to add them as a node on the graph
#the more lines they say (the larger their speaker count) the larger we will draw the node
add_nodes_to_graph(speaker_count, graph)
edge_list = {}
add_lines_to_graph(edge_list, actors_scene, graph, num_overlap)
#save the graph to an image file
save_graph(graph, num_overlap)
###
dom = parse(play)
speaker_count = Counter()
#This will keep a track of how many lines each character has in the act
#and stores it in the form (Characters_Name: number_of_lines)
count_lines_for_each_speaker(dom, speaker_count)
#create an empty list
actors_scene = {}
get_list_of_speakers_each_scene(dom, actors_scene)
#actors_scene now holds information about all the characters in each scene that speak
#in the form {ACT I SCENE I': set(['HORATIO', 'FRANCISCO', 'BERNARDO'])}
#create an empty graph to draw our network on
graph = pydot.Dot(graph_type='graph',overlap=False)
#for every person who speaks, we are going to need to add them as a node on the graph
#the more lines they say (the larger their speaker count) the larger we will draw the node
add_nodes_to_graph(speaker_count, graph)
edge_list = {}
add_lines_to_graph(edge_list, actors_scene, graph, num_overlap)
#save the graph to an image file
save_graph(graph, num_overlap)