-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgetAwardScores.py
61 lines (49 loc) · 1.46 KB
/
getAwardScores.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
import re
# normal wins
def get_wins(text):
pattern = re.compile(r'\d+\s+[win]')
match = pattern.search(text)
if match:
return int(text[match.start(0) : match.end(0) - 1])
else:
return None
# normal nominations
def get_nominations(text):
pattern = re.compile(r'\d+\s+[nomination]')
match = pattern.search(text)
if match:
return int(text[match.start(0) : match.end(0) - 1])
else:
return None
# oscar wins
def get_oscars_wins(text):
pattern = re.compile(r'[Won]+\s+\d+\s+[Oscar]')
match = pattern.search(text)
if match:
return int(text[match.start(0) + 3 : match.end(0) - 1])
else:
return None
# oscar nominations
def get_oscars_nominations(text):
pattern = re.compile(r'[for]\s+\d+\s+[Oscar]')
match = pattern.search(text)
if match:
return int(text[match.start(0) + 1 : match.end(0) - 1])
else:
return None
# golden globe wins
def get_golden_wins(text):
pattern = re.compile(r'[Won]\s+\d+\s+[Golden]')
match = pattern.search(text)
if match:
return int(text[match.start(0) + 1 : match.end(0) - 1])
else:
return None
# golden nominations
def get_golden_nominations(text):
pattern = re.compile(r'[for]\s+\d+\s+[Golden]')
match = pattern.search(text)
if match:
return int(text[match.start(0) + 1 : match.end(0) - 1])
else:
return None