Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
fdalvi committed Jan 30, 2024
1 parent 491fd23 commit 1e077c7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ def config():


def prompt(input_sample):
base_prompt = (
f'Given the following tweet, label it as "HS" or "NOT_HS" based on the content of the tweet: \n {input_sample}'
)
base_prompt = f'Given the following tweet, label it as "HS" or "NOT_HS" based on the content of the tweet: \n {input_sample}'
return [
{
"role": "user",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ def config():


def prompt(input_sample):
base_prompt = (
f'if the following Arabic sentence is offensive, just say "OFF", otherwise, say just "NOT_OFF" without explanation: \n {input_sample}'
)
base_prompt = f'if the following Arabic sentence is offensive, just say "OFF", otherwise, say just "NOT_OFF" without explanation: \n {input_sample}'
return [
{
"role": "user",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ def config():


def prompt(input_sample):
base_prompt = (
f"If the following sentence can be classified as spam or contains an advertisemnt, write '__label__ADS' without explnanation, otherwise write '__label__NOTADS' without explanantion.\n {input_sample}\n"
)
base_prompt = f"If the following sentence can be classified as spam or contains an advertisemnt, write '__label__ADS' without explnanation, otherwise write '__label__NOTADS' without explanantion.\n {input_sample}\n"
return [
{
"role": "user",
Expand All @@ -42,7 +40,7 @@ def post_process(response):
if j > 0:
out = out[0:j]
if "NOTADS" in out:
out = '__label__NOTADS'
out = "__label__NOTADS"
elif "ADS" in out:
out = '__label__ADS'
out = "__label__ADS"
return out
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def prompt(input_sample):


def post_process(response):
label = response["choices"][0]["message"]["content"].lower().replace('.', '')
label = response["choices"][0]["message"]["content"].lower().replace(".", "")

if "لاموضوعية" in label:
label_fixed = "SUBJ"
Expand Down

0 comments on commit 1e077c7

Please sign in to comment.