Skip to content

Commit d291c7e

Browse files
authored
Merge pull request #4 from aconser/revert-3-Taft-Chapter
Revert "Updates allowing for different approach to stats"
2 parents 021c167 + bd64359 commit d291c7e

File tree

63 files changed

+4187
-5705
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+4187
-5705
lines changed

Additional Research Tools/Assessing Meter Tools.py

Lines changed: 0 additions & 33 deletions
This file was deleted.
Binary file not shown.
Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
1-
# -*- coding: utf-8 -*-
2-
"""
3-
CLASS METER_DICT
4-
5-
Compiles statistics extracted from a group of LineGroup objects.
6-
7-
@author: Anna Conser, Columbia University, [email protected]
8-
@license: MIT
9-
"""
10-
from operator import itemgetter
11-
12-
class Meter_Dict:
13-
14-
def __init__(self, line_groups):
15-
self.meter_dict = {}
16-
self._lines = []
17-
self.add_lines(line_groups)
18-
self._consolidated = {}
19-
20-
@property
21-
def corrupt (self):
22-
return any(l.corrupt for l in self._lines)
23-
24-
def add_lines (self, line_groups):
25-
for l in line_groups:
26-
meter = ''.join(l.meter) #translate list into string
27-
if meter in self.meter_dict:
28-
self.meter_dict[meter].append(l.stats)
29-
else:
30-
self.meter_dict[meter] = [l.stats]
31-
self._lines.extend(line_groups)
32-
self._consolidated = {}
33-
34-
@property
35-
def consolidated (self):
36-
if not self._consolidated:
37-
consolidated = {}
38-
for key, entries in self.meter_dict.items():
39-
count = len(entries)
40-
match_av = sum([match for match, repeat in entries])/count
41-
repeat_av = sum([repeat for match, repeat in entries])/count
42-
consolidated [key] = (count, match_av, repeat_av)
43-
self._consolidated = consolidated
44-
return self._consolidated
45-
46-
def most_common (self, top=10):
47-
tuples = [(key, entry[0]) for key, entry in self.consolidated.items()]
48-
tuples.sort(key=itemgetter(1), reverse=True)
49-
return tuples[:top]
50-
51-
def most_matches (self, top=10):
52-
tuples = [(key, entry[1], entry[0]) for key, entry in self.consolidated.items()]
53-
tuples.sort(key=itemgetter(1), reverse=True)
54-
return tuples[:top]
55-
56-
def most_repeats (self, top=10):
57-
tuples = [(key, entry[2], entry[0]) for key, entry in self.consolidated.items()]
58-
tuples.sort(key=itemgetter(1))
59-
return tuples[:top]
60-
61-
def best_responsion (self, top=10):
62-
tuples = [(key, entry[0], entry[1], entry[2]) for key, entry
63-
in self.consolidated.items() if entry[0] > 1]
64-
tuples.sort(key=lambda tup: tup[2]-tup[3], reverse=True)
65-
return tuples[:top]
66-
67-
def worst_responsion (self, top=10):
68-
tuples = [(key, entry[0], entry[1], entry[2]) for key, entry
69-
in self.consolidated.items() if entry[0] > 1]
70-
tuples.sort(key=lambda tup: tup[2]-tup[3])
71-
return tuples[:top]
72-
73-
1+
# -*- coding: utf-8 -*-
2+
"""
3+
CLASS METER_DICT
4+
5+
Compiles statistics extracted from a group of LineGroup objects.
6+
7+
@author: Anna Conser, Columbia University, [email protected]
8+
@license: MIT
9+
"""
10+
from operator import itemgetter
11+
12+
class Meter_Dict:
13+
14+
def __init__(self, line_groups):
15+
self.meter_dict = {}
16+
self._lines = []
17+
self.add_lines(line_groups)
18+
self._consolidated = {}
19+
20+
@property
21+
def corrupt (self):
22+
return any(l.corrupt for l in self._lines)
23+
24+
def add_lines (self, line_groups):
25+
for l in line_groups:
26+
meter = ''.join(l.meter) #translate list into string
27+
if meter in self.meter_dict:
28+
self.meter_dict[meter].append(l.stats)
29+
else:
30+
self.meter_dict[meter] = [l.stats]
31+
self._lines.extend(line_groups)
32+
self._consolidated = {}
33+
34+
@property
35+
def consolidated (self):
36+
if not self._consolidated:
37+
consolidated = {}
38+
for key, entries in self.meter_dict.items():
39+
count = len(entries)
40+
match_av = sum([match for match, repeat in entries])/count
41+
repeat_av = sum([repeat for match, repeat in entries])/count
42+
consolidated [key] = (count, match_av, repeat_av)
43+
self._consolidated = consolidated
44+
return self._consolidated
45+
46+
def most_common (self, top=10):
47+
tuples = [(key, entry[0]) for key, entry in self.consolidated.items()]
48+
tuples.sort(key=itemgetter(1), reverse=True)
49+
return tuples[:top]
50+
51+
def most_matches (self, top=10):
52+
tuples = [(key, entry[1], entry[0]) for key, entry in self.consolidated.items()]
53+
tuples.sort(key=itemgetter(1), reverse=True)
54+
return tuples[:top]
55+
56+
def most_repeats (self, top=10):
57+
tuples = [(key, entry[2], entry[0]) for key, entry in self.consolidated.items()]
58+
tuples.sort(key=itemgetter(1))
59+
return tuples[:top]
60+
61+
def best_responsion (self, top=10):
62+
tuples = [(key, entry[0], entry[1], entry[2]) for key, entry
63+
in self.consolidated.items() if entry[0] > 1]
64+
tuples.sort(key=lambda tup: tup[2]-tup[3], reverse=True)
65+
return tuples[:top]
66+
67+
def worst_responsion (self, top=10):
68+
tuples = [(key, entry[0], entry[1], entry[2]) for key, entry
69+
in self.consolidated.items() if entry[0] > 1]
70+
tuples.sort(key=lambda tup: tup[2]-tup[3])
71+
return tuples[:top]
72+
73+

Additional Research Tools/parsons.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

Analysis/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# -*- coding: utf-8 -*-
2-
"""
3-
Created on Mon May 28 10:20:59 2018
4-
5-
@author: Anna
6-
"""
7-
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Mon May 28 10:20:59 2018
4+
5+
@author: Anna
6+
"""
7+
-288 Bytes
Binary file not shown.
-7 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
-10.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)