MCPcopy Create free account

hub / github.com/Multiverse-of-Projects/NewsAI / functions

Functions33 in github.com/Multiverse-of-Projects/NewsAI

↓ 11 callersFunctionsetup_logger
Sets up a logger with a console handler and a rotating file handler. The console handler has color coding for different log levels, while th
src/utils/logger.py:7
↓ 6 callersFunctionappend_to_document
Appends new data to an existing document in the MongoDB collection. Args: collection_name (str): The name of the MongoDB collection.
src/utils/dbconnector.py:119
↓ 6 callersFunctionget_mongo_client
Connects to MongoDB and returns the database object. Uses environment variables for connection: MONGO_USERNAME: username for MongoDB
src/utils/dbconnector.py:16
↓ 4 callersFunctionfetch_article_content
Fetches the content of a list of articles asynchronously, by checking if content already exists in the database, and if not, extracting the conte
src/ingestion/fetch_articles.py:29
↓ 4 callersFunctionfind_documents
Finds documents in the given MongoDB collection using the given query. Args: collection_name (str): The name of the MongoDB collecti
src/utils/dbconnector.py:146
↓ 3 callersFunctionfetch_news
Fetches news articles from NewsAPI for the given query, from date and sort_by. Args: query (str): The query to search for in the New
src/ingestion/newsapi.py:20
↓ 2 callersFunctionanalyze_sentiments
Analyze the sentiment of a list of article IDs. Args: article_ids (List[str]): List of article IDs to analyze. Returns:
src/sentiment_analysis/sentiment_model.py:12
↓ 2 callersFunctionclean_content
Clean a string by replacing carriage returns and newlines with spaces and then removing excessive spaces. Args: content (str): The s
src/ingestion/prawapi.py:35
↓ 2 callersFunctioncontent_manager
Checks if the specified fields are present in the database for the given article_id. Args: article_id (str): The ID of the article t
src/utils/dbconnector.py:44
↓ 2 callersFunctionfind_one_document
Finds a single document in the given MongoDB collection using the given query. Args: collection_name (str): The name of the collecti
src/utils/dbconnector.py:95
↓ 2 callersFunctiongenerate_wordcloud
Generates a word cloud for the given list of keywords and sentiment label. Args: keywords (List[str]): List of keywords to include i
src/sentiment_analysis/wordcloud.py:12
↓ 2 callersFunctioninsert_document
Inserts a document into the given collection. Args: collection_name (str): The name of the collection. document (dict): The
src/utils/dbconnector.py:70
↓ 2 callersFunctionprocess_articles
Process a list of articles by fetching content, summarizing, extracting keywords and analyzing sentiment. Args: query (str): The que
src/pipeline.py:158
↓ 2 callersFunctionsummarize_texts
Summarizes a list of texts using a pre-trained Transformer model. Args: texts (List[str]): List of texts to summarize. max_l
src/preprocessing/summarization.py:20
↓ 1 callersFunctionanalyze_sentiments_async
Asynchronous wrapper for analyze_sentiments. Args: article_id (str): ID of the article to analyze. Returns: List[Dict[s
src/pipeline.py:51
↓ 1 callersFunctioncreate_and_show_gif
Creates a GIF from a list of PIL Image objects and displays it in Streamlit. Args: image_files (List[PIL.Image.Image]): List of PIL
src/dashboard/app.py:57
↓ 1 callersFunctiondownload_images
Downloads a list of images from the given URLs and returns a list of PIL Image objects. Args: image_urls (List[str]): List of URLs o
src/dashboard/app.py:30
↓ 1 callersFunctionextract_and_flatten_keywords
Extracts and flattens a list of lists of keywords from a dataset. Args: data (pd.DataFrame): Pandas DataFrame containing a column na
src/dashboard/app.py:80
↓ 1 callersFunctionextract_keywords
Extracts keywords from a list of texts using KeyBERT. Args: texts (List[str]): List of texts to extract keywords from. top_n
src/preprocessing/keyword_extraction.py:71
↓ 1 callersFunctionextract_keywords_async
Asynchronous wrapper for extract_keywords. Args: article_id (str): ID of the article to extract keywords from. Returns:
src/pipeline.py:37
↓ 1 callersFunctionfetch_and_combine_articles
Fetches documents from the given MongoDB collection using the given IDs and combines them into a Pandas DataFrame. Args: collection_
src/utils/dbconnector.py:170
↓ 1 callersFunctionfetch_content
Fetches the content of a single article asynchronously. Args: id (str): The ID of the article to fetch content for.
src/ingestion/fetch_articles.py:69
↓ 1 callersFunctionfetch_reddit_posts_by_keyword
Fetches Reddit posts containing the given keyword. Args: keyword (str): The keyword to search for in Reddit posts. limit (in
src/ingestion/prawapi.py:54
↓ 1 callersFunctionhighlight_keywords
(text, keywords)
src/dashboard/app.py:278
↓ 1 callersFunctionprocess_articles_async
Process a list of articles asynchronously, by fetching content, summarizing, extracting keywords and analyzing sentiment. Args: quer
src/pipeline.py:125
↓ 1 callersFunctionprocess_single_article_async
Process a single article asynchronously, by fetching content, summarizing, extracting keywords and analyzing sentiment. Args: articl
src/pipeline.py:65
↓ 1 callersFunctionsummarize_texts_async
Asynchronous wrapper for summarize_texts. Args: article_id (str): ID of the article to summarize. Returns: str: Summari
src/pipeline.py:23
↓ 1 callersFunctiontest_fetch_article_content
Tests the fetch_article_content function by fetching content for a list of article IDs. Args: article_ids (List[str]): A list of art
src/ingestion/fetch_articles.py:119
Functionbert_keyword_extraction
Extracts keywords from a list of texts using KeyBERT. Args: texts (List[str]): List of texts to extract keywords from. top_n
src/preprocessing/keyword_extraction.py:46
Functionclassify_sentiments
Classify the sentiment of multiple texts. Args: texts (List[str]): List of text to classify sentiment for. Returns: Dic
src/sentiment_analysis/classify.py:10
Functiongenerate_spiderweb
Generates a spiderweb chart using Streamlit's ECharts component. Args: data (dict): Dictionary where the keys are the topic names an
src/dashboard/app.py:123
Functionload_css
Loads a CSS file and injects it into the Streamlit app. Args: file_name (str): Path to the CSS file to load. Returns: N
src/dashboard/app.py:102
Functionpreprocess_text
Preprocesses a given text by tokenizing it and removing stopwords. Args: text (str): The text to preprocess. Returns: L
src/preprocessing/keyword_extraction.py:20