|
import warnings
|
|
from py.data_fetch import *
|
|
from py.handle_files import *
|
|
from py.db_storage import *
|
|
|
|
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
from langchain.schema import Document
|
|
from typing import List, Dict, Any
|
|
warnings.filterwarnings("ignore")
|
|
|
|
stock="nse"
|
|
|
|
|
|
|
|
data_fetch = DataFetch()
|
|
data_fetch.load_company_list("Stock Sentiment Analysis/Resources/"+stock+"_companies.csv")
|
|
social_media_data = data_fetch.collect_data()
|
|
|
|
|
|
create_files(social_media_data)
|
|
|
|
|
|
social_media_document = fetch_social_media_data()
|
|
print(len(social_media_document))
|
|
|
|
|
|
social_media_document_samples = sample_documents(social_media_document, 20)
|
|
print(len(social_media_document_samples))
|
|
|
|
|
|
clear_db()
|
|
|
|
|
|
chroma_db = DBStorage()
|
|
|
|
|
|
FAISS_DB_PATH = os.path.join(os.getcwd(), "Stock Sentiment Analysis", "faiss_HD")
|
|
chroma_db.embed_vectors(social_media_document_samples, FAISS_DB_PATH)
|
|
|
|
|
|
|
|
|
|
|
|
|