Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,9 +72,13 @@ def search_pattern(fulltext, pattern, method):
|
|
| 72 |
start = time.time()
|
| 73 |
occurrence = 0
|
| 74 |
for i in range(0,len(fulltext)-len(pattern)+1):
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
end = time.time()
|
| 80 |
time_elapse = end - start
|
|
|
|
| 72 |
start = time.time()
|
| 73 |
occurrence = 0
|
| 74 |
for i in range(0,len(fulltext)-len(pattern)+1):
|
| 75 |
+
found = 1
|
| 76 |
+
for l in range(len(pattern)):
|
| 77 |
+
if fulltext[i+l] != pattern[l]:
|
| 78 |
+
found = 0
|
| 79 |
+
if found:
|
| 80 |
+
occurrence += 1
|
| 81 |
+
print("Found ", fulltext[i:i+len(pattern)], ' locating at position ', i+1)
|
| 82 |
|
| 83 |
end = time.time()
|
| 84 |
time_elapse = end - start
|