Views
No views yet
| Tag | Category | Examples of terms |
|---|---|---|
B-Food / I-Food | Food | паста, стейк, порции, суп |
B-Service / I-Service | Service | официант, персонал, обслуживание |
B-Price / I-Price | Price | цены, счёт, стоимость |
B-Interior / I-Interior | Interior | интерьер, музыка, атмосфера |
B-Delivery / I-Delivery | Delivery | доставка, курьер, заказ |
O | — | everything else |
1from transformers import pipeline
2
3ate = pipeline(
4 "token-classification",
5 model="billerjully/BERT-absa-rest-reviews-ate",
6 aggregation_strategy="simple", # merges B-/I- tokens into whole terms
7)
8
9text = "Паста была превосходной, но официант нас совсем забыл, а цены завышены."
10for aspect in ate(text):
11 print(aspect["entity_group"], text[aspect["start"]:aspect["end"]], round(aspect["score"], 3))Food паста 0.98
Service официант 0.98
Price цены 0.92Tip: offsets (start/end) are Python code-point indices. If you highlight spans in JavaScript, slice the text as an array of code points (Array.from(text)) — emoji in reviews shift UTF-16 indices otherwise.
| Category | Mentions |
|---|---|
| Food | 9,481 |
| Service | 4,985 |
| Interior | 2,892 |
| Price | 1,087 |
| Delivery | 849 |
I- tags are very rare in the training data (< 60 occurrences),
so multi-word aspect terms are seldom produced.