forked from Archives/langchain
Fix WhatsAppChatLoader regex pattern for 24 hour time format (#2458)
Fix for 24 hour time format bug. Now whatsapp regex is able to parse either 12 or 24 hours time format. Linked [issue](https://github.com/hwchase17/langchain/issues/2457).
This commit is contained in:
parent
3acf423de0
commit
60c837c58a
@ -28,7 +28,7 @@ class WhatsAppChatLoader(BaseLoader):
|
|||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
result = re.match(
|
result = re.match(
|
||||||
r"(\d{1,2}/\d{1,2}/\d{2,4}, \d{1,2}:\d{1,2} (?:AM|PM)) - (.*?): (.*)",
|
r"(\d{1,2}/\d{1,2}/\d{2,4}, \d{1,2}:\d{1,2}(?: AM| PM)?) - (.*?): (.*)",
|
||||||
line.strip(),
|
line.strip(),
|
||||||
)
|
)
|
||||||
if result:
|
if result:
|
||||||
|
Loading…
Reference in New Issue
Block a user