Skip to content

Commit 774ff3c

Browse files
authored
Update date (#626)
1 parent 837bfc2 commit 774ff3c

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

replace-string-python/transcript_basic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
transcript = """
2-
[support_tom] 2022-08-24T10:02:23+00:00 : What can I help you with?
3-
[johndoe] 2022-08-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT
4-
[support_tom] 2022-08-24T10:03:30+00:00 : Are you sure it's not your caps lock?
5-
[johndoe] 2022-08-24T10:04:03+00:00 : Blast! You're right!
2+
[support_tom] 2025-01-24T10:02:23+00:00 : What can I help you with?
3+
[johndoe] 2025-01-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT
4+
[support_tom] 2025-01-24T10:03:30+00:00 : Are you sure it's not your caps lock?
5+
[johndoe] 2025-01-24T10:04:03+00:00 : Blast! You're right!
66
"""
77

88
print(transcript.replace("BLASTED", "😤"))

replace-string-python/transcript_multiple_replace.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
REPLACEMENTS = [
22
("BLASTED", "😤"),
33
("Blast", "😤"),
4-
("2022-08-24T", ""),
4+
("2025-01-24T", ""),
55
("+00:00", ""),
66
("[support_tom]", "Agent "),
77
("[johndoe]", "Client"),
88
]
99

1010
transcript = """
11-
[support_tom] 2022-08-24T10:02:23+00:00 : What can I help you with?
12-
[johndoe] 2022-08-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT
13-
[support_tom] 2022-08-24T10:03:30+00:00 : Are you sure it's not your caps lock?
14-
[johndoe] 2022-08-24T10:04:03+00:00 : Blast! You're right!
11+
[support_tom] 2025-01-24T10:02:23+00:00 : What can I help you with?
12+
[johndoe] 2025-01-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT
13+
[support_tom] 2025-01-24T10:03:30+00:00 : Are you sure it's not your caps lock?
14+
[johndoe] 2025-01-24T10:04:03+00:00 : Blast! You're right!
1515
"""
1616

1717
for old, new in REPLACEMENTS:

replace-string-python/transcript_reduce.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
REPLACEMENTS = [
44
("BLASTED", "😤"),
55
("Blast", "😤"),
6-
("2022-08-24T", ""),
6+
("2025-01-24T", ""),
77
("+00:00", ""),
88
("[support_tom]", "Agent "),
99
("[johndoe]", "Client"),
1010
]
1111

1212
transcript = """
13-
[support_tom] 2022-08-24T10:02:23+00:00 : What can I help you with?
14-
[johndoe] 2022-08-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT
15-
[support_tom] 2022-08-24T10:03:30+00:00 : Are you sure it's not your caps lock?
16-
[johndoe] 2022-08-24T10:04:03+00:00 : Blast! You're right!
13+
[support_tom] 2025-01-24T10:02:23+00:00 : What can I help you with?
14+
[johndoe] 2025-01-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT
15+
[support_tom] 2025-01-24T10:03:30+00:00 : Are you sure it's not your caps lock?
16+
[johndoe] 2025-01-24T10:04:03+00:00 : Blast! You're right!
1717
"""
1818

1919
print(reduce(lambda acc, item: acc.replace(*item), REPLACEMENTS, transcript))

replace-string-python/transcript_regex.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
]
99

1010
transcript = """
11-
[support_tom] 2022-08-24T10:02:23+00:00 : What can I help you with?
12-
[johndoe] 2022-08-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT
13-
[support_tom] 2022-08-24T10:03:30+00:00 : Are you sure it's not your caps lock?
14-
[johndoe] 2022-08-24T10:04:03+00:00 : Blast! You're right!
11+
[support_tom] 2025-01-24T10:02:23+00:00 : What can I help you with?
12+
[johndoe] 2025-01-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT
13+
[support_tom] 2025-01-24T10:03:30+00:00 : Are you sure it's not your caps lock?
14+
[johndoe] 2025-01-24T10:04:03+00:00 : Blast! You're right!
1515
"""
1616

1717
for new, old in REGEX_REPLACEMENTS:

replace-string-python/transcript_regex_callback.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def sanitize_message(match):
3131

3232

3333
transcript = """
34-
[support_tom] 2022-08-24T10:02:23+00:00 : What can I help you with?
35-
[johndoe] 2022-08-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT
36-
[support_tom] 2022-08-24T10:03:30+00:00 : Are you sure it's not your caps lock?
37-
[johndoe] 2022-08-24T10:04:03+00:00 : Blast! You're right!
34+
[support_tom] 2025-01-24T10:02:23+00:00 : What can I help you with?
35+
[johndoe] 2025-01-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT
36+
[support_tom] 2025-01-24T10:03:30+00:00 : Are you sure it's not your caps lock?
37+
[johndoe] 2025-01-24T10:04:03+00:00 : Blast! You're right!
3838
"""
3939

4040
print(re.sub(ENTRY_PATTERN, sanitize_message, transcript))

0 commit comments

Comments
 (0)