eddie14 commited on
Commit
204b48f
1 Parent(s): be6bbc3
.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
.idea/common_crawl.iml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="jdk" jdkName="Python 3.8 (hf-pipelines)" jdkType="Python SDK" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
.idea/inspectionProfiles/Project_Default.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
5
+ <option name="ignoredPackages">
6
+ <value>
7
+ <list size="8">
8
+ <item index="0" class="java.lang.String" itemvalue="konoise" />
9
+ <item index="1" class="java.lang.String" itemvalue="transformers" />
10
+ <item index="2" class="java.lang.String" itemvalue="seqeval" />
11
+ <item index="3" class="java.lang.String" itemvalue="torch" />
12
+ <item index="4" class="java.lang.String" itemvalue="datasets" />
13
+ <item index="5" class="java.lang.String" itemvalue="glove-python-binary" />
14
+ <item index="6" class="java.lang.String" itemvalue="faiss-gpu" />
15
+ <item index="7" class="java.lang.String" itemvalue="tensorflow-gpu" />
16
+ </list>
17
+ </value>
18
+ </option>
19
+ </inspection_tool>
20
+ <inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
21
+ <option name="ignoredErrors">
22
+ <list>
23
+ <option value="N802" />
24
+ </list>
25
+ </option>
26
+ </inspection_tool>
27
+ </profile>
28
+ </component>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (hf-pipelines)" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/common_crawl.iml" filepath="$PROJECT_DIR$/.idea/common_crawl.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
common_crawl.py CHANGED
@@ -77,11 +77,12 @@ class CommonCrawl(datasets.GeneratorBasedBuilder):
77
  logger.info("generating examples from = %s", filepath)
78
  filepath = filepath.split("::")[-1]
79
  _open = lambda x: ArchiveIterator(requests.get(x, stream=True).raw, arc2warc=True) \
80
- if filepath.startswith("http") else lambda x: ArchiveIterator(open(x, "rb"))
81
  number = 0
82
- print("filepath::", _open)
83
- for record in _open(filepath):
 
84
  if record.rec_type == 'response' and record.http_headers.get_header('Content-Type') == 'text/html':
85
  text = _decode_text(record.content_stream().read())
86
  if text is not None:
87
- yield number, {"id": number, "text": text}
 
77
  logger.info("generating examples from = %s", filepath)
78
  filepath = filepath.split("::")[-1]
79
  _open = lambda x: ArchiveIterator(requests.get(x, stream=True).raw, arc2warc=True) \
80
+ if filepath.startswith("http") else lambda x: ArchiveIterator(open(x, "rb").raw, arc2warc=True)
81
  number = 0
82
+ _iterator = _open(filepath)
83
+ print(_iterator)
84
+ for record in _iterator:
85
  if record.rec_type == 'response' and record.http_headers.get_header('Content-Type') == 'text/html':
86
  text = _decode_text(record.content_stream().read())
87
  if text is not None:
88
+ yield number, {"id": nu