Remove manager
Browse files- wikipedia.py +10 -11
wikipedia.py
CHANGED
@@ -1027,18 +1027,16 @@ class Wikipedia(datasets.GeneratorBasedBuilder):
|
|
1027 |
|
1028 |
result_q = multiprocess.Queue()
|
1029 |
processes = []
|
|
|
|
|
|
|
|
|
|
|
|
|
1030 |
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
content = _extract_content(filepath)
|
1035 |
-
for obj in tqdm(content):
|
1036 |
-
result_q.put(_clean_content(obj, language=language))
|
1037 |
-
result_q.put(ProcessDone())
|
1038 |
-
|
1039 |
-
p = multiprocess.Process(target=parse_and_clean)
|
1040 |
-
p.start()
|
1041 |
-
processes.append(p)
|
1042 |
|
1043 |
n = len(filepaths)
|
1044 |
complete = 0
|
@@ -1055,6 +1053,7 @@ class Wikipedia(datasets.GeneratorBasedBuilder):
|
|
1055 |
for p in processes:
|
1056 |
p.join()
|
1057 |
|
|
|
1058 |
def _parse_and_clean_wikicode(raw_content, parser, language):
|
1059 |
"""Strips formatting and unwanted sections from raw page content."""
|
1060 |
wikicode = parser.parse(raw_content)
|
|
|
1027 |
|
1028 |
result_q = multiprocess.Queue()
|
1029 |
processes = []
|
1030 |
+
for filepath in filepaths:
|
1031 |
+
def parse_and_clean():
|
1032 |
+
content = _extract_content(filepath)
|
1033 |
+
for obj in tqdm(content):
|
1034 |
+
result_q.put(_clean_content(obj, language=language))
|
1035 |
+
result_q.put(ProcessDone())
|
1036 |
|
1037 |
+
p = multiprocess.Process(target=parse_and_clean)
|
1038 |
+
p.start()
|
1039 |
+
processes.append(p)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1040 |
|
1041 |
n = len(filepaths)
|
1042 |
complete = 0
|
|
|
1053 |
for p in processes:
|
1054 |
p.join()
|
1055 |
|
1056 |
+
|
1057 |
def _parse_and_clean_wikicode(raw_content, parser, language):
|
1058 |
"""Strips formatting and unwanted sections from raw page content."""
|
1059 |
wikicode = parser.parse(raw_content)
|