-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (27 loc) · 1.38 KB
/
main.py
File metadata and controls
29 lines (27 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
from make_title_ID_dicts import make_title_id
from make_graph import make_graph
from compactify import compactify
path_to_data = "./data/"
if __name__ == "__main__":
print "Download latest Wiki dump..."
# For EnWiki
# os.system("wget -c -P " + path_to_data + " https://dumps.wikimedia.org/enwiki/latest/enwiki-latest-page.sql.gz")
# os.system("gunzip -c " + path_to_data + "*page.sql.gz > " + path_to_data + "page.sql")
#os.system("wget -c -P " + path_to_data + " https://dumps.wikimedia.org/enwiki/latest/enwiki-latest-pagelinks.sql.gz")
#os.system("gunzip -c " + path_to_data + "*pagelinks.sql.gz > " + path_to_data + "pagelinks.sql")
# For SimpleWiki
os.system("wget -c -P " + path_to_data + " https://dumps.wikimedia.org/simplewiki/latest/simplewiki-latest-page.sql.gz")
os.system("gunzip -c " + path_to_data + "*page.sql.gz > " + path_to_data + "page.sql")
os.system("wget -c -P " + path_to_data + " https://dumps.wikimedia.org/simplewiki/latest/simplewiki-latest-pagelinks.sql.gz")
os.system("gunzip -c " + path_to_data + "*pagelinks.sql.gz > " + path_to_data + "pagelinks.sql")
print "Download latest Wiki dump... Done"
print "Make title-id dictionaries..."
make_title_id(path_to_data)
print "Make title-id dictionaries... Done"
print "Make graph..."
make_graph(path_to_data)
print "Make graph... Done"
print "Compactify..."
compactify(path_to_data)
print "Compactify... Done"