1T Conte commited on
Commit
94a47f5
1 Parent(s): edba353

fix: removed weird descpritions

Browse files
convert.py CHANGED
@@ -56,7 +56,14 @@ def _clean_html(text):
56
  # remove extra spaces at the beginning of the text
57
  lines = [line.strip() for line in text.split("\n")]
58
 
59
- return "\n".join(lines)
 
 
 
 
 
 
 
60
 
61
 
62
  def _clean_image(image):
@@ -107,11 +114,8 @@ def run():
107
  "text": _clean_html(description),
108
  }
109
 
110
- # Skipping rows with empty texts
111
- if not obj["text"]:
112
- continue
113
-
114
- rows.append(obj)
115
 
116
  # Add a label to each row
117
  _categories = list(categories)
 
56
  # remove extra spaces at the beginning of the text
57
  lines = [line.strip() for line in text.split("\n")]
58
 
59
+ output = "\n".join(lines)
60
+
61
+ output = output.strip()
62
+
63
+ if output == "null":
64
+ return ""
65
+
66
+ return output
67
 
68
 
69
  def _clean_image(image):
 
114
  "text": _clean_html(description),
115
  }
116
 
117
+ if obj["text"]:
118
+ rows.append(obj)
 
 
 
119
 
120
  # Add a label to each row
121
  _categories = list(categories)
data/all/.~lock.train.csv# ADDED
@@ -0,0 +1 @@
 
 
1
+ ,marcio,marcio-AX370-Gaming,10.04.2024 19:56,file:///home/marcio/.config/libreoffice/4;
data/all/test.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c9f4467feb81a1d13d44286edba2c20fd336dff55d159bc118b8b97f9a3b6010
3
- size 168228486
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb60f014952b4e1ae53fb3788e3e2b3a76e927ebf65931d87f2f8bcf5d22ad73
3
+ size 168573267
data/all/train.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:906253e12209cfa45dad42d4465e010fda158a2eed65f9632611eacd1f0a0253
3
- size 674478545
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8a9cf578e8a092d61ed556cebecdf96f3a2a13c8773792e6facbf03f36d8239
3
+ size 674112358
data/top4/test.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6905b392ca173cc15fcc75c3242bd4d3ebb5689c1366835e40674dfb7e828a74
3
- size 86414336
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8fb2c8e2218bd3e976e147bbefc3bfa6b5575bb29966910a7d835bd1e5cd5d6a
3
+ size 85898679
data/top4/train.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f0633bceac2f5775eb0d2fb456cc62edd203af9125d01d85e0ea9ff7d729bc7a
3
- size 258077981
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f52847721502d0f473e6eac9e7704cb13ddf325ab9c36a79ec811c19e2614f56
3
+ size 258202157
test_convert.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Module to test some previously found bugs in the convert.py file.
3
+ """
4
+
5
+ from unittest import TestCase
6
+
7
+
8
+ from convert import _clean_html
9
+
10
+
11
+ class TestConvert(TestCase):
12
+ """
13
+ Class to test the convert.py file.
14
+ """
15
+
16
+ def test_clean_description(self):
17
+ """
18
+ Test some weird description which contains a "null" value after parsed,
19
+ which causes problem when parsed by a CSV parser.
20
+ """
21
+ description = 'null\n<div class=\'nifad\'><a href="http://www.pheedo.com/click.phdo?x=a8a276f7a37a42499f8b1c69f9acf191&u=182589199"><img src="http://www.pheedo.com/img.phdo?x=a8a276f7a37a42499f8b1c69f9acf191&u=182589199" border="0"/></a></div>'
22
+ parsed = _clean_html(description)
23
+
24
+ self.assertEqual(parsed, "")