gauneg's picture
Update README.md
06626f3 verified
|
raw
history blame
1.71 kB
---
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.
The extracted aspect terms will be the span(s) from the input text on which a sentiment is being expressed.
## Datasets
This model has been trained on the following datasets:
1. Aspect Based Sentiment Analysis SemEval Shared Tasks ([2014](https://aclanthology.org/S14-2004/), [2015](https://aclanthology.org/S15-2082/), [2016](https://aclanthology.org/S16-1002/))
2. Multi-Aspect Multi-Sentiment [MAMS](https://aclanthology.org/D19-1654/)
# Use
* Importing the libraries and loading the models and the pipeline
```python
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:
```python
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:
```bash
[{'entity_group': 'pos',
'score': 0.8447307,
'word': ' food',
'start': 26,
'end': 30},
{'entity_group': 'neg',
'score': 0.81927896,
'word': ' service',
'start': 56,
'end': 63}]
```