File size: 1,578 Bytes
effc10e
 
 
4e5f4b6
effc10e
 
 
4e5f4b6
1f9b5e3
a974e8f
 
 
 
 
 
 
 
 
 
27979bb
 
 
8d529a8
 
27979bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d2dd34b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
language:
- en
license: apache-2.0
base_model:
- FacebookAI/roberta-base
pipeline_tag: token-classification
---

# 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:

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}]

```