metadata
language:
- en
license: apache-2.0
base_model:
- FacebookAI/roberta-base
pipeline_tag: token-classification
library_name: transformers
Training
This model is designed for token classification tasks, enabling it to extract aspect terms and predict the sentiment polarity associated with the extracted aspect terms.
Datasets
This model has been trained on the following datasets:
- Aspect Based Sentiment Analysis SemEval Shared Tasks (2014, 2015, 2016)
- Multi-Aspect Multi-Sentiment MAMS
Use
- Importing the libraries and loading the models and the pipeline
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline
model_id = "gauneg/roberta-base-absa-ate-sentiment"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForTokenClassification.from_pretrained(model_id)
ate_sent_pipeline = pipeline(task='ner',
aggregation_strategy='simple',
tokenizer=tokenizer,
model=model)
- Using the pipeline object:
text_input = "Been here a few times and food has always been good but service really suffers when it gets crowded."
ate_sent_pipeline(text_input)
- pipeline output:
[{'entity_group': 'pos',
'score': 0.8447307,
'word': ' food',
'start': 26,
'end': 30},
{'entity_group': 'neg',
'score': 0.81927896,
'word': ' service',
'start': 56,
'end': 63}]