Update paraphraser.py
Browse files- 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
|
22 |
-
"- Ensure the rewritten comment retains the original intent but in a constructive tone
|
|
|
23 |
"Examples:\n"
|
24 |
"Toxic: \"You're so dumb! You never understand anything!\"\n"
|
25 |
-
"Neutral: \"
|
26 |
"Toxic: \"This is the worst idea ever. Only an idiot would suggest this.\"\n"
|
27 |
-
"Neutral: \"I’
|
28 |
-
"Toxic: \"You
|
29 |
-
"Neutral: \"
|
|
|
|
|
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 don’t think this idea works well.\"\n"
|
29 |
+
"Toxic: \"You’re useless.\"\n"
|
30 |
+
"Neutral: \"This isn’t 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)
|