This repository contains code for an Antidote Recommendation Tool that utilizes vector-based and topic modeling approaches to recommend antidotes for fake claims. In addition the tool leverages the bipartite graph representation and topic modeling techniques to identify relevant antidotes from a corpus of claims.
AntidoteRecs/gfc.py
: Contains functions for retrieving claims from the Google Fact Check API.AntidoteRecs/vectorizers.py
: Contains theVectorizer
class for transforming claims into embeddings using pre-trained models.AntidoteRecs/antidote.py
: Contains functions for retrieving antidotes based on vector-based and topic modeling approaches.AntidoteRecs/claim_topic.py
: Contains functions for extracting topics from a corpus of claims.AntidoteRecs/graphs.py
: Contains functions for building bipartite graphs based on user-submission interactions.AntidoteRecs/preemptive.py
: Contains functions for predicting the next topic of interest for a given user.
To use the Antidote Recommendation Tool, follow these steps:
- Import the necessary functions and classes from the respective files.
- Retrieve claims from the Google Fact Check API (optional) using the
get_claims
function fromAntidoteRecs.gfc
or load the instance of claims using theload_data
function fromAntidoteRecs.gfc
or any other suitable method. - Initialize a vectorizer using the
Vectorizer
class fromAntidoteRecs.vectorizers
. Choose a pre-trained model appropriate for your task. - Utilize the
get_antidotes
function fromAntidoteRecs.antidote
to retrieve antidotes based on the vector-based approach. Pass the fake claim, corpus, vectorizer, and the desired number of top antidotes to retrieve.
- Import the necessary functions and classes from the respective files.
- Load the corpus of claims using the
load_data
function fromAntidoteRecs.gfc
or any other suitable method. - Initialize a vectorizer using the
Vectorizer
class fromAntidoteRecs.vectorizers
. Choose a pre-trained model appropriate for your task. - Perform topic modeling on the corpus using the
extract_topics
function fromAntidoteRecs.claim_topic
. Specify the number of topics desired and provide the corpus and vectorizer. - Utilize the
get_antidotes
function fromAntidoteRecs.antidote
to retrieve antidotes based on the topic modeling approach. Pass the fake claim, corpus, vectorizer, number of top antidotes, and the topic of the fake claim obtained from topic modeling.
- Import the necessary functions and classes from the respective files.
- Build a bipartite graph representation of user-submission interactions using the
extract_graph
function fromAntidoteRecs.graphs
. - Create a user-to-topic bipartite graph using the
user_to_topic_graph
function fromAntidoteRecs.graphs
, providing the user-submission graph, corpus, topic modeling results, and vectorizer. - Predict the next topic of interest for a given user using the
predict_next_topic
function fromAntidoteRecs.preemptive
. - Retrieve the claims and their corresponding reviews that belong to the predicted next topic using the topic information.