-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerated_code.py
51 lines (40 loc) · 1.5 KB
/
generated_code.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
################################################################################
# START GENERATED HEADER
import sys
import os
import re
# END GENERATED HEADER
################################################################################
################################################################################
# CODE PROVIDED FROM PYFLEX FILE
################################################################################
import atexit
verb_count = 0
verb_list = []
def IncrementVerbCounter(text):
global verb_count
global verb_list
verb_count += 1
verb_list.append(text)
def PrintVerbCount():
print("Found " + str(verb_count) + " verbs!")
print(verb_list)
@atexit.register
def EndProgram() -> None:
PrintVerbCount()
################################################################################
# GENERATED DRIVER
################################################################################
if __name__ == '__main__':
for files in sys.argv[1:]:
print('FILE: {}'.format(files))
lines_from_file = []
with open(file=sys.argv[1]) as f:
lines = f.readlines()
for line in lines:
for word in line.split(' '):
if re.match(pattern='[a-zA-Z]*_[^Nn\t\n]*[V]+[^Nn\t\n]*', string=word) is not None:
IncrementVerbCounter(word)
################################################################################
# END GENERATED CODE
################################################################################