-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
79 lines (78 loc) · 2.79 KB
/
Copy pathmain.py
File metadata and controls
79 lines (78 loc) · 2.79 KB
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
74
75
76
77
78
79
from report import Reporter
import substring_finder
import os
import re
if __name__ == '__main__':
substring_finders = [
substring_finder.brute_force,
substring_finder.KMP_algorithm,
substring_finder.z_function_finder,
substring_finder.BMH_algorithm,
substring_finder.AC_algorithm,
]
comparing_parameters = [
(
r"BigDataWithoutRepeating.txt",
"ними",
"Big data without repeating (len(substring) == 4)",
),
(
r"BigDataWithoutRepeating.txt",
"Сонский",
"Big data without repeating (len(substring) == 7)",
),
(
r"BigDataWithoutRepeating.txt",
"Мы предлагаем вам",
"Big data without repeating (len(substring) == 17)",
),
(
r"BigDataWithoutRepeating.txt",
"%D0%9A%D0%BE%D0%BB%D1%8C%D1%86%D0%B0",
"Big data without repeating (len(substring) == 36)",
),
(
r"SmallDataWithoutRepeating.txt",
"них",
"Small data without repeating (len(substring) == 3)",
),
(
r"SmallDataWithoutRepeating.txt",
"Mon Dieu",
"Small data without repeating (len(substring) == 8)",
),
(
r"SmallDataWithoutRepeating.txt",
"Доктор посмотрел",
"Small data without repeating (len(substring) == 16)",
),
(
r"SmallDataWithoutRepeating.txt",
"Зала ресторации превратилась",
"Small data without repeating (len(substring) == 28)",
),
(
r"BeginningAndEndingOfSubstringRepeatManyTimes.txt",
"the same part finish the same part",
"Beginning and ending of substring repeat many times",
),
(
r"BeginningOfSubstringRepeatManyTimes.txt",
"Hello my dear Sun",
"Beginning of substring repeat many times",
),
(
r"SubstringContainsFewDifferentLetters.txt",
"aaaaaaaaff",
"Substring contains few different letters",
),
]
texts_path = os.path.dirname(__file__) + "\\texts\\"
comparing_parameters = list(map(lambda x: (texts_path + x[0], x[1], x[2]),
comparing_parameters))
groups_patterns = [re.compile(r'(Big data without repeating)(.*)'),
re.compile(r'(Small data without repeating)(.*)'),
re.compile(
r'(.*\brepeat\b.*)|(Substring contains few different letters)')]
reporter = Reporter(substring_finders, comparing_parameters, 51, groups_patterns)
reporter.generate_statistics()