mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-31 10:23:18 +00:00
Update WhatsAppChatLoader to include the character ~ in the sender name (#4420)
Fixes #4153 If the sender of a message in a group chat isn't in your contact list, they will appear with a ~ prefix in the exported chat. This PR adds support for parsing such lines.
This commit is contained in:
@@ -44,7 +44,7 @@ class WhatsAppChatLoader(BaseLoader):
|
||||
)
|
||||
\]?
|
||||
[\s-]*
|
||||
([\w\s]+)
|
||||
([~\w\s]+)
|
||||
[:]+
|
||||
\s
|
||||
(.+)
|
||||
|
@@ -16,4 +16,5 @@ def test_whatsapp_chat_loader() -> None:
|
||||
"User name on 11/8/21, 9:41:32 AM: Message 123\n\n"
|
||||
"User 2 on 1/23/23, 3:19 AM: Bye!\n\n"
|
||||
"User 1 on 1/23/23, 3:22_AM: And let me know if anything changes\n\n"
|
||||
"~ User name 2 on 1/24/21, 12:41:03 PM: Of course!\n\n"
|
||||
)
|
||||
|
@@ -1,4 +1,5 @@
|
||||
[05.05.23, 15:48:11] James: Hi here
|
||||
[11/8/21, 9:41:32 AM] User name: Message 123
|
||||
1/23/23, 3:19 AM - User 2: Bye!
|
||||
1/23/23, 3:22_AM - User 1: And let me know if anything changes
|
||||
1/23/23, 3:22_AM - User 1: And let me know if anything changes
|
||||
[1/24/21, 12:41:03 PM] ~ User name 2: Of course!
|
Reference in New Issue
Block a user