dominguesm commited on
Commit
50db406
1 Parent(s): f625c88

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +58 -0
README.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ tags:
4
+ - seq2seq
5
+ - t5
6
+ - positive_perspectives
7
+ widget:
8
+ - 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."
9
+ - text: "['growth']: You know I really don't care about the power struggle between the papacy and secular authority in the medieval ages. stupid"
10
+ - text: "['neutralizing', 'optimism']: thinking about my future makes me want to go live on a island alone forever. annoyed"
11
+ - text: "['neutralizing', 'optimism']: Honestly don't know how I'm going to finish all of this homework and projects! homework FAIL Tired FML"
12
+ - 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."
13
+ ---
14
+
15
+ # Positive Perspectives with English Text Reframing
16
+
17
+ ## Model description
18
+
19
+ 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).
20
+
21
+ ## How to use
22
+
23
+ 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:
24
+
25
+ **Input**:
26
+ ```
27
+ ['growth']: totally fed up with this bid now! :-( haven't even thought about my presentation yet :-(
28
+ ```
29
+
30
+ ### Available sentiment strategies:
31
+
32
+ | Strategy | Description |
33
+ | --------- | ----------- |
34
+ |**growth** | viewing a challenging event as an opportunity for the author to specifically grow or improve himself.|
35
+ |**impermanence**| Saying that bad things don't last forever, will get better soon, and/or that other people have had similar difficulties.|
36
+ |**neutralizing**| Replacing a negative word with a neutral word. For example, “This was a terrible day” becomes “This was a long day”.|
37
+ |**optimism**| Focusing on things about the situation itself, at that moment, that are good (not just predicting a better future).|
38
+ |**self_affirmation**| Talking about what strengths the author already has, or values he admires, such as love, courage, perseverance, etc.|
39
+ |**thankfulness**| Expressing gratitude or gratitude with keywords like appreciate, happy for it, grateful for, good thing, etc.|
40
+
41
+ ### Usage
42
+
43
+ ```python
44
+ from transformers import pipeline
45
+
46
+ pipe = pipeline('summarization', "dominguesm/positive-reframing-en")
47
+
48
+ text = "['growth']: totally fed up with this bid now! :-( haven't even thought about my presentation yet :-("
49
+
50
+ pipe(text, max_length=1024)
51
+
52
+ ```
53
+
54
+ **Output**:
55
+
56
+ ```
57
+ # 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.
58
+ ```