|
|
import os |
|
|
import pandas as pd |
|
|
import random |
|
|
|
|
|
bad_words = ["stupid", "idiot", "hate you", "shut up", "worst", "trash", "dumb"] |
|
|
good_words = ["hello", "thank you", "nice", "amazing", "respect", "kind", "helpful"] |
|
|
|
|
|
data=[] |
|
|
for _ in range(500): |
|
|
data.append({"text": random.choice(bad_words), "label": 1}) |
|
|
|
|
|
for _ in range(500): |
|
|
data.append({"text": random.choice(good_words), "label": 0}) |
|
|
|
|
|
random.shuffle(data) |
|
|
df = pd.DataFrame(data) |
|
|
|
|
|
|
|
|
|
|
|
os.makedirs("./../data", exist_ok=True) |
|
|
|
|
|
df.to_csv("./../data/text.csv", index=False) |