initial
Browse files- common_crawl.py +3 -1
common_crawl.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gzip
|
2 |
import logging
|
3 |
-
|
4 |
import requests
|
5 |
import urllib.request
|
6 |
from typing import Optional
|
@@ -53,6 +53,8 @@ def _preprocessing(text):
|
|
53 |
tag.decompose()
|
54 |
|
55 |
text = tree.body.text(separator='\n')
|
|
|
|
|
56 |
return text
|
57 |
|
58 |
|
|
|
1 |
import gzip
|
2 |
import logging
|
3 |
+
import re
|
4 |
import requests
|
5 |
import urllib.request
|
6 |
from typing import Optional
|
|
|
53 |
tag.decompose()
|
54 |
|
55 |
text = tree.body.text(separator='\n')
|
56 |
+
text = re.sub("\n{2,}", "\n\n", text)
|
57 |
+
text = re.sub("\t{2,}", "\t\t", text)
|
58 |
return text
|
59 |
|
60 |
|