File size: 3,023 Bytes
50db406 ffc4e24 50db406 |
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 59 |
---
language: en
license: cc-by-4.0
tags:
- seq2seq
- t5
- positive_perspectives
widget:
- text: "['neutralizing', 'optimism']: Ugh I have to wake up so early (9:00) and go to class (a massage). I have so much (so little) to do today."
- text: "['growth']: You know I really don't care about the power struggle between the papacy and secular authority in the medieval ages. stupid"
- text: "['neutralizing', 'optimism']: thinking about my future makes me want to go live on a island alone forever. annoyed"
- text: "['neutralizing', 'optimism']: Honestly don't know how I'm going to finish all of this homework and projects! homework FAIL Tired FML"
- text: "['neutralizing', 'optimism', 'thankfulness']: Who would have ever guessed that it would be so freaking hard to get three different grades from two different schools together."
---
# Positive Perspectives with English Text Reframing
## Model description
This model is a [T5-base](https://huggingface.co/t5-base) adjusted to the sentiment transfer task, where the objective is to reverse the sentiment polarity of a text without contradicting the original meaning. Positive reframing induces a complementary positive viewpoint (e.g. glass-half-full) escaping negative patterns. Based on the article [arXiv:2204.02952](https://arxiv.org/abs/2204.02952).
## How to use
The model uses one or more sentiment strategies concatenated with a sentence and will generate a sentence with the applied sentiment output. The maximum string length is 1024 tokens. Entries must be organized in the following format:
**Input**:
```
['growth']: totally fed up with this bid now! :-( haven't even thought about my presentation yet :-(
```
### Available sentiment strategies:
| Strategy | Description |
| --------- | ----------- |
|**growth** | viewing a challenging event as an opportunity for the author to specifically grow or improve himself.|
|**impermanence**| Saying that bad things don't last forever, will get better soon, and/or that other people have had similar difficulties.|
|**neutralizing**| Replacing a negative word with a neutral word. For example, “This was a terrible day” becomes “This was a long day”.|
|**optimism**| Focusing on things about the situation itself, at that moment, that are good (not just predicting a better future).|
|**self_affirmation**| Talking about what strengths the author already has, or values he admires, such as love, courage, perseverance, etc.|
|**thankfulness**| Expressing gratitude or gratitude with keywords like appreciate, happy for it, grateful for, good thing, etc.|
### Usage
```python
from transformers import pipeline
pipe = pipeline('summarization', "dominguesm/positive-reframing-en")
text = "['growth']: totally fed up with this bid now! :-( haven't even thought about my presentation yet :-("
pipe(text, max_length=1024)
```
**Output**:
```
# I haven't thought about my presentation yet, but I'm going to work hard to improve #my presentation, and I'll be better soon.
``` |