JanviMl commited on
Commit
d0ff307
·
verified ·
1 Parent(s): b482c00

Update paraphraser.py

Browse files
Files changed (1) hide show
  1. paraphraser.py +9 -6
paraphraser.py CHANGED
@@ -18,15 +18,18 @@ def paraphrase_comment(comment):
18
  "You are a content moderator tasked with rewriting toxic comments into neutral and constructive ones while maintaining the original meaning. "
19
  "Follow these guidelines:\n"
20
  "- Remove explicit hate speech, personal attacks, or offensive language.\n"
21
- "- Keep the response neutral and conversational, suitable for a casual online platform.\n"
22
- "- Ensure the rewritten comment retains the original intent but in a constructive tone, addressing the specific context of the comment (e.g., disagreement, frustration).\n\n"
 
23
  "Examples:\n"
24
  "Toxic: \"You're so dumb! You never understand anything!\"\n"
25
- "Neutral: \"I think there might be a misunderstanding here. Can we go over this again to clear things up?\"\n"
26
  "Toxic: \"This is the worst idea ever. Only an idiot would suggest this.\"\n"
27
- "Neutral: \"I’m not sure this idea works for me. Could we look at some other options instead?\"\n"
28
- "Toxic: \"You are an idiot and should leave this platform.\"\n"
29
- "Neutral: \"It seems like you might not be enjoying this platform. Maybe we can talk about whats not working for you?\"\n\n"
 
 
30
  f"Now, rewrite this comment: \"{comment}\""
31
  )
32
  inputs = tokenizer(prompt, return_tensors="pt", truncation=True, padding=True, max_length=512)
 
18
  "You are a content moderator tasked with rewriting toxic comments into neutral and constructive ones while maintaining the original meaning. "
19
  "Follow these guidelines:\n"
20
  "- Remove explicit hate speech, personal attacks, or offensive language.\n"
21
+ "- Keep the response neutral and professional.\n"
22
+ "- Ensure the rewritten comment retains the original intent but in a constructive tone.\n"
23
+ "- Match the length and brevity of the original toxic comment whenever possible. Keep the response short and to the point.\n\n"
24
  "Examples:\n"
25
  "Toxic: \"You're so dumb! You never understand anything!\"\n"
26
+ "Neutral: \"You might be misunderstanding this.\"\n"
27
  "Toxic: \"This is the worst idea ever. Only an idiot would suggest this.\"\n"
28
+ "Neutral: \"I dont think this idea works well.\"\n"
29
+ "Toxic: \"You’re useless.\"\n"
30
+ "Neutral: \"This isnt helping much.\"\n"
31
+ "Toxic: \"Shut up.\"\n"
32
+ "Neutral: \"Let’s take a break from this.\"\n\n"
33
  f"Now, rewrite this comment: \"{comment}\""
34
  )
35
  inputs = tokenizer(prompt, return_tensors="pt", truncation=True, padding=True, max_length=512)