dominguesm's picture
Update README.md
6bbd01d
|
raw
history blame
No virus
2.8 kB
metadata
language: pt
tags:
  - seq2seq
  - t5
  - positive_perspectives
widget:
  - text: >-
      ['agradecimento', 'otimismo']: Tenho tanta coisa para fazer antes de sair
      da cidade por uma semana no domingo.
  - text: >-
      ['auto_afirmacao']: Aquele momento, você percebe que todo o trabalho duro
      foi para nada e você não tem controle sobre nada.
  - text: >-
      ['impermanencia']: Um daqueles dias em que você sente que precisa de um
      abraço de cinco minutos, um pacote de marshmallows e um amigo para
      conversar.
  - text: >-
      ['neutralizando', 'otimismo']: Pensar no meu futuro me faz querer viver
      numa ilha sozinha para sempre.
  - text: >-
      ['crescimento', 'otimismo']: A lista de coisas que tenho que fazer hoje é
      para sempre longa. Posso simplesmente voltar para a cama e acordar amanhã
      com tudo feito?

Positive Perspectives with Portuguese Text Reframing

Model description

This model is a PTT5 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.

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:

"['agradecimento', 'otimismo']: Tenho tanta coisa para fazer antes de sair da cidade por uma semana no domingo."

Available sentiment strategies:

crescimento: viewing a challenging event as an opportunity for the author to specifically grow or improve himself.

impermanencia: Saying that bad things don't last forever, will get better soon, and/or that other people have had similar difficulties.

neutralizando: Replacing a negative word with a neutral word. For example, “This was a terrible day” becomes “This was a long day”.

otimismo: Focusing on things about the situation itself, at that moment, that are good (not just predicting a better future).

auto_afirmacao: Talking about what strengths the author already has, or values he admires, such as love, courage, perseverance, etc.

agradecimento: Expressing gratitude or gratitude with keywords like appreciate, happy for it, grateful for, good thing, etc.

Usage

from transformers import pipeline

pipe = pipeline('summarization', "dominguesm/positive-reframing-ptbr")

text = "['agradecimento', 'otimismo']: Tenho tanta coisa para fazer antes de sair da cidade por uma semana no domingo."

pipe(text, max_length=1024)