| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Stance Classifier for the WeVerify project, to determine the stance (support, deny, question, comment) of a "reply" tweet or other social media post towards the original "target" post to which it is replying.
This is the latest version of the classifier, with target-aware and target-oblivious models based on BERTweet and XLM-RoBERTa. For the older multilingual BERT-based models see the bert-model branch
There are two versions of the stance classifier available:
python -m StanceClassifier reply.json [original.json]
The reply and (if provided) original arguments should be JSON files containing tweets in JSON format with at least a "text" or "full_text" property containing the text. If only a reply is provided then the target-oblivious model will be used, if an original tweet is provided as well then the ensemble model will be used that combines a target-oblivious and a target-aware model and picks the best classification.
The output is a class:
and a vector with the probabilities returned for each class.
The folder examples contains examples of original tweets and replies:
The project provides three main classes, StanceClassifer for target-oblivious stance detection and StanceClassifierEnsemble for the target-aware ensemble model, plus StanceClassifierWithTarget that uses only the target-aware model. All these classes can be imported from StanceClassifier.stance_classifier, and will download their models from HuggingFace on first use.
The docker directory contains configuration to build a Docker image running a particular model of the classifier as an HTTP endpoint compliant with the API specification of the European Language Grid.
To train new models, you can edit train_model.py (more support will be given in the future). To run:
python train_model.py
| Back | FazBrowse Home | New Git URL |