contemmcm commited on
Commit
b80e9f0
1 Parent(s): 0afb211

Upload 4 files

Browse files
Files changed (5) hide show
  1. .gitattributes +2 -0
  2. README.md +43 -0
  3. complete.csv +3 -0
  4. convert.py +41 -0
  5. polarity.csv +3 -0
.gitattributes CHANGED
@@ -53,3 +53,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
53
  *.jpg filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
 
 
 
53
  *.jpg filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
56
+ complete.csv filter=lfs diff=lfs merge=lfs -text
57
+ polarity.csv filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ task_categories:
3
+ - text-classification
4
+ language:
5
+ - en
6
+
7
+ dataset_info:
8
+ - config_name: full
9
+ features:
10
+ - name: text
11
+ dtype: string
12
+ - name: label
13
+ dtype:
14
+ class_label:
15
+ names:
16
+ '0': very negative
17
+ '1': negative
18
+ '2': neutral
19
+ '3': positive
20
+ '4': very positive
21
+ - config_name: full
22
+ features:
23
+ - name: text
24
+ dtype: string
25
+ - name: label
26
+ dtype:
27
+ class_label:
28
+ names:
29
+ '0': negative
30
+ '1': positive
31
+
32
+ configs:
33
+ - config_name: full
34
+ data_files:
35
+ - split: complete
36
+ path: "complete.csv"
37
+ default: true
38
+ - config_name: polarity
39
+ data_files:
40
+ - split: complete
41
+ path: "polarity.csv"
42
+ default: true
43
+ ---
complete.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:49358880eac8b8ca383d64fa36bb1c0fe1f81c0b53b68c33d1348a93df5ab27e
3
+ size 124219344
convert.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+ import random
3
+
4
+ import pandas as pd
5
+
6
+
7
+ def remap_polarity(row):
8
+ if row["label"] < 2:
9
+ row["label"] = 0
10
+ else:
11
+ row["label"] = 1
12
+ return row
13
+
14
+
15
+ def run():
16
+ rows = []
17
+
18
+ with open(
19
+ "training.1600000.processed.noemoticon.csv", "r", encoding="ISO-8859-1"
20
+ ) as file:
21
+ reader = csv.reader(file)
22
+ for row in reader:
23
+ rows.append({"label": int(row[0]), "text": row[5]})
24
+
25
+ df = pd.DataFrame(rows)
26
+ df.to_csv("complete.csv", index=False)
27
+
28
+ polarity_rows = [remap_polarity(row) for row in rows if row["label"] != 2]
29
+ positive_rows = [row for row in polarity_rows if row["label"] == 1]
30
+ negative_rows = [row for row in polarity_rows if row["label"] == 0]
31
+ min_size = min(len(positive_rows), len(negative_rows))
32
+ polarity_rows = positive_rows[:min_size] + negative_rows[:min_size]
33
+
34
+ random.shuffle(polarity_rows)
35
+
36
+ df = pd.DataFrame(polarity_rows)
37
+ df.to_csv("polarity.csv", index=False)
38
+
39
+
40
+ if __name__ == "__main__":
41
+ run()
polarity.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:09f43f9e8a3ab5b6164301afea5c5f5acc2999b600040fca071f5a291ebd7767
3
+ size 124219344