nreimers commited on
Commit
3fe68ac
1 Parent(s): 3f2fc30
Files changed (5) hide show
  1. README.md +3 -0
  2. original.csv +3 -0
  3. prepare.py +36 -0
  4. test.jsonl +3 -0
  5. train.jsonl +3 -0
README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ This is a version of the [Quora Insincere Questions Classification](https://www.kaggle.com/c/quora-insincere-questions-classification).
2
+
3
+ An insincere question is defined as a question intended to make a statement rather than look for helpful answers. About 6% of questions are labeled as insincere.
original.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b8549942872d29c9eeb9778762a51d122e12a4e61d1e657cd9cd275a403b415
3
+ size 124206772
prepare.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ from collections import Counter
3
+ import json
4
+ import random
5
+
6
+
7
+ df = pd.read_csv("original.csv")
8
+
9
+ print(df)
10
+
11
+
12
+ rows = [{'qid': row['qid'],
13
+ 'text': row['question_text'].strip(),
14
+ 'label': row['target'],
15
+ 'label_text': "insincere question" if row['target'] else "valid question",
16
+ } for idx, row in df.iterrows()]
17
+
18
+ random.seed(42)
19
+ random.shuffle(rows)
20
+
21
+ num_test = 50000
22
+ splits = {'test': rows[0:num_test], 'train': rows[num_test:]}
23
+
24
+ print("Train:", len(splits['train']))
25
+ print("Test:", len(splits['test']))
26
+
27
+ num_labels = Counter()
28
+
29
+ for row in splits['test']:
30
+ num_labels[row['label']] += 1
31
+ print(num_labels)
32
+
33
+ for split in ['train', 'test']:
34
+ with open(f'{split}.jsonl', 'w') as fOut:
35
+ for row in splits[split]:
36
+ fOut.write(json.dumps(row)+"\n")
test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1c3e8e3e5ae0055f10d9bb64c2dadbeba1b16144a4b02afeefbb1a802425c747
3
+ size 7957420
train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e0955e0af5e194f28119b9dd170bb7a599385be7f07e29934c13fdf3b665043
3
+ size 199930964