Update py/handle_files.py
Browse files- py/handle_files.py +9 -4
py/handle_files.py
CHANGED
|
@@ -8,8 +8,10 @@ from typing import List
|
|
| 8 |
from langchain.schema import Document
|
| 9 |
import pandas as pd
|
| 10 |
|
| 11 |
-
def create_files(social_media_data):
|
| 12 |
-
folder_path = 'files'
|
|
|
|
|
|
|
| 13 |
|
| 14 |
if not os.path.exists(folder_path):
|
| 15 |
os.makedirs(folder_path)
|
|
@@ -28,8 +30,11 @@ def create_files(social_media_data):
|
|
| 28 |
|
| 29 |
df.to_pickle(folder_path+"/social_media_data.pkl")
|
| 30 |
|
| 31 |
-
def fetch_social_media_data():
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
| 33 |
data = json.load(file)
|
| 34 |
social_media_document = []
|
| 35 |
for item in data:
|
|
|
|
| 8 |
from langchain.schema import Document
|
| 9 |
import pandas as pd
|
| 10 |
|
| 11 |
+
def create_files(social_media_data, hugg = False):
|
| 12 |
+
folder_path = 'Stock Sentiment Analysis/files'
|
| 13 |
+
if hugg:
|
| 14 |
+
folder_path = 'files'
|
| 15 |
|
| 16 |
if not os.path.exists(folder_path):
|
| 17 |
os.makedirs(folder_path)
|
|
|
|
| 30 |
|
| 31 |
df.to_pickle(folder_path+"/social_media_data.pkl")
|
| 32 |
|
| 33 |
+
def fetch_social_media_data(hugg = False):
|
| 34 |
+
file_path = 'Stock Sentiment Analysis/files/social_media_data.json'
|
| 35 |
+
if hugg:
|
| 36 |
+
file_path = 'files/social_media_data.json'
|
| 37 |
+
with open(file_path, 'r') as file:
|
| 38 |
data = json.load(file)
|
| 39 |
social_media_document = []
|
| 40 |
for item in data:
|