initial commit
Browse files- app.py +6 -6
- facebook_chat.json +44 -0
app.py
CHANGED
@@ -47,12 +47,12 @@ def get_csv_file(csv_docs):
|
|
47 |
csv_doc = csv_loader.load()
|
48 |
return csv_doc
|
49 |
|
50 |
-
def get_json_file(
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
json_doc = json_loader.load()
|
57 |
return json_doc
|
58 |
|
|
|
47 |
csv_doc = csv_loader.load()
|
48 |
return csv_doc
|
49 |
|
50 |
+
def get_json_file():
|
51 |
+
json_loader = JSONLoader(
|
52 |
+
file_path='homework4/facebook_chat.json',
|
53 |
+
jq_schema='.messages[].content',
|
54 |
+
text_content=False
|
55 |
+
)
|
56 |
json_doc = json_loader.load()
|
57 |
return json_doc
|
58 |
|
facebook_chat.json
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{'image': {'creation_timestamp': 1675549016, 'uri': 'image_of_the_chat.jpg'},
|
2 |
+
'is_still_participant': True,
|
3 |
+
'joinable_mode': {'link': '', 'mode': 1},
|
4 |
+
'magic_words': [],
|
5 |
+
'messages': [{'content': 'Bye!',
|
6 |
+
'sender_name': 'User 2',
|
7 |
+
'timestamp_ms': 1675597571851},
|
8 |
+
{'content': 'Oh no worries! Bye',
|
9 |
+
'sender_name': 'User 1',
|
10 |
+
'timestamp_ms': 1675597435669},
|
11 |
+
{'content': 'No Im sorry it was my mistake, the blue one is not '
|
12 |
+
'for sale',
|
13 |
+
'sender_name': 'User 2',
|
14 |
+
'timestamp_ms': 1675596277579},
|
15 |
+
{'content': 'I thought you were selling the blue one!',
|
16 |
+
'sender_name': 'User 1',
|
17 |
+
'timestamp_ms': 1675595140251},
|
18 |
+
{'content': 'Im not interested in this bag. Im interested in the '
|
19 |
+
'blue one!',
|
20 |
+
'sender_name': 'User 1',
|
21 |
+
'timestamp_ms': 1675595109305},
|
22 |
+
{'content': 'Here is $129',
|
23 |
+
'sender_name': 'User 2',
|
24 |
+
'timestamp_ms': 1675595068468},
|
25 |
+
{'photos': [{'creation_timestamp': 1675595059,
|
26 |
+
'uri': 'url_of_some_picture.jpg'}],
|
27 |
+
'sender_name': 'User 2',
|
28 |
+
'timestamp_ms': 1675595060730},
|
29 |
+
{'content': 'Online is at least $100',
|
30 |
+
'sender_name': 'User 2',
|
31 |
+
'timestamp_ms': 1675595045152},
|
32 |
+
{'content': 'How much do you want?',
|
33 |
+
'sender_name': 'User 1',
|
34 |
+
'timestamp_ms': 1675594799696},
|
35 |
+
{'content': 'Goodmorning! $50 is too low.',
|
36 |
+
'sender_name': 'User 2',
|
37 |
+
'timestamp_ms': 1675577876645},
|
38 |
+
{'content': 'Hi! Im interested in your bag. Im offering $50. Let '
|
39 |
+
'me know if you are interested. Thanks!',
|
40 |
+
'sender_name': 'User 1',
|
41 |
+
'timestamp_ms': 1675549022673}],
|
42 |
+
'participants': [{'name': 'User 1'}, {'name': 'User 2'}],
|
43 |
+
'thread_path': 'inbox/User 1 and User 2 chat',
|
44 |
+
'title': 'User 1 and User 2 chat'}
|