Spaces:
Sleeping
Sleeping
Commit
·
08b0576
1
Parent(s):
e08d181
Update preprocess.py
Browse files- preprocess.py +6 -0
preprocess.py
CHANGED
|
@@ -8,6 +8,7 @@ def preprocess(data):
|
|
| 8 |
pattern1 = r'\d{2}/\d{2}/\d{2}, \d{1,2}:\d{2}[ap]m -'
|
| 9 |
pattern2 = r'\[\d{2}/\d{2}/\d{2}, \d{2}:\d{2}:\d{2}\]'
|
| 10 |
pattern3 = r'\d{2}/\d{2}/\d{2}, \d{1,2}:\d{2} -'
|
|
|
|
| 11 |
|
| 12 |
# data = "30/06/21, 1:46pm - Gauri Mami turned off disappearing messages."
|
| 13 |
|
|
@@ -32,6 +33,11 @@ def preprocess(data):
|
|
| 32 |
dates = re.findall(pattern3, data)
|
| 33 |
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
if not result:
|
| 36 |
result = None
|
| 37 |
|
|
|
|
| 8 |
pattern1 = r'\d{2}/\d{2}/\d{2}, \d{1,2}:\d{2}[ap]m -'
|
| 9 |
pattern2 = r'\[\d{2}/\d{2}/\d{2}, \d{2}:\d{2}:\d{2}\]'
|
| 10 |
pattern3 = r'\d{2}/\d{2}/\d{2}, \d{1,2}:\d{2} -'
|
| 11 |
+
pattern4 = r'\d{1,2}/\d{1,2}/\d{2}, \d{2}:\d{2} -'
|
| 12 |
|
| 13 |
# data = "30/06/21, 1:46pm - Gauri Mami turned off disappearing messages."
|
| 14 |
|
|
|
|
| 33 |
dates = re.findall(pattern3, data)
|
| 34 |
|
| 35 |
|
| 36 |
+
if re.search(pattern4, data):
|
| 37 |
+
result.append(data)
|
| 38 |
+
messages = re.split(pattern4, data)[1:]
|
| 39 |
+
dates = re.findall(pattern4, data)
|
| 40 |
+
|
| 41 |
if not result:
|
| 42 |
result = None
|
| 43 |
|