1T Conte commited on
Commit
eb1ae63
1 Parent(s): adf9c86

fix: ratings from 1-10 to 0-9

Browse files
README.md CHANGED
@@ -4,6 +4,48 @@ language:
4
  task_categories:
5
  - text-classification
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  configs:
8
  - config_name: default
9
  data_files:
 
4
  task_categories:
5
  - text-classification
6
 
7
+ dataset_info:
8
+ - config_name: default
9
+ features:
10
+ - name: id
11
+ dtype: int64
12
+ - name: drugName
13
+ dtype: string
14
+ - name: condition
15
+ dtype: string
16
+ - name: review
17
+ dtype: string
18
+ - name: rating
19
+ dtype:
20
+ class_label:
21
+ names:
22
+ '0': 1
23
+ '1': 2
24
+ '2': 3
25
+ '3': 4
26
+ '4': 5
27
+ '5': 6
28
+ '6': 7
29
+ '7': 8
30
+ '8': 9
31
+ '9': 10
32
+ - config_name: sentiment
33
+ features:
34
+ - name: id
35
+ dtype: int64
36
+ - name: drugName
37
+ dtype: string
38
+ - name: condition
39
+ dtype: string
40
+ - name: review
41
+ dtype: string
42
+ - name: rating
43
+ dtype:
44
+ class_label:
45
+ names:
46
+ '0': negative
47
+ '1': positive
48
+
49
  configs:
50
  - config_name: default
51
  data_files:
complete.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2817f31c2558813c95742c3f592797c670090184cc604faa74a0a22ae14f316e
3
- size 107763488
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:669accfa314ea249d3c73b861b79f8dad8dc1d26a69d23bf7b0c72966a9e5a93
3
+ size 107695483
convert.py CHANGED
@@ -16,7 +16,7 @@ def parse_review(html):
16
 
17
 
18
  def parse_rating(rating_str):
19
- rating = int(rating_str)
20
  return rating
21
 
22
 
@@ -49,7 +49,7 @@ def read_file(file_path):
49
 
50
 
51
  def remap2sentiment(row):
52
- if row["rating"] <= 4:
53
  row["rating"] = 0
54
  else:
55
  row["rating"] = 1
@@ -72,8 +72,8 @@ def run():
72
 
73
  # Extract only ratings 1, 2, 3, and 4 (negative reviews), and also
74
  # ratings 7, 8, 9, and 10 (positive reviews)
75
- negative_rows = [remap2sentiment(row) for row in all_rows if row["rating"] <= 4]
76
- positive_rows = [remap2sentiment(row) for row in all_rows if row["rating"] >= 7]
77
  positive_negative_rows = negative_rows + positive_rows
78
  shuffle(positive_negative_rows)
79
  save(positive_negative_rows, "positive_negative.csv")
 
16
 
17
 
18
  def parse_rating(rating_str):
19
+ rating = int(rating_str) - 1
20
  return rating
21
 
22
 
 
49
 
50
 
51
  def remap2sentiment(row):
52
+ if row["rating"] <= 3:
53
  row["rating"] = 0
54
  else:
55
  row["rating"] = 1
 
72
 
73
  # Extract only ratings 1, 2, 3, and 4 (negative reviews), and also
74
  # ratings 7, 8, 9, and 10 (positive reviews)
75
+ negative_rows = [remap2sentiment(row) for row in all_rows if row["rating"] <= 3]
76
+ positive_rows = [remap2sentiment(row) for row in all_rows if row["rating"] >= 6]
77
  positive_negative_rows = negative_rows + positive_rows
78
  shuffle(positive_negative_rows)
79
  save(positive_negative_rows, "positive_negative.csv")
positive_negative.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:79bc54b2e84c261a9f2870b6094fef66b6c3f6f0dee3472121548e1eabcf4f04
3
  size 97800610
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6287c39f984e36d5c8baa3fa916b4294862c8e5d677877f391ae616c96c7fc41
3
  size 97800610
positive_negative_balanced.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a2f57a99c1f62054fe0df39cd677d2178b3cf842d31a11d599abc173c0c1a787
3
  size 53025847
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0bf8e51f78f230a0f75aeb2867d9fcadb667049024662439d4efff4724ba98cd
3
  size 53025847
test.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:be700a0c1da6967ca1db27a624d649010bb9d0c66e8cd3489268f8f89c740960
3
- size 26919224
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:033919465c8c773ab19a1ee8870ac65cc39015ffa65f4e90115d5e2b106ca942
3
+ size 26902208
train.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:49c1ebdf38ee8443a0cb6ea79de630375e0609d4119e2d77ee4a35b20e299517
3
- size 80844317
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:67cf2e63f868b0baee5da08ec88c288cfb59781424f4266db16bed049b4e1027
3
+ size 80793328