forked from hunkim/deep_architecture_genealogy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
txt2md.py
28 lines (24 loc) · 1.21 KB
/
txt2md.py
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
# Simple txt to README.md
# Just download txt and png after updating from
# https://coggle.it/diagram/Wf5mYoJbsgABUF9P and
# run this script
head='# Deep Architecture Genealogy\n' \
'There are so many new models and architectures. ' \
'If you find something interesting and worth paying attention to, ' \
'please send us a pull requests (PR) and write issues.\n' \
'`README.md` is automatically generated. Please send PRs on the `Neural Net Arch Genealogy.txt` file.\n' \
'## Mindmap Coggle Link\n' \
'https://coggle.it/diagram/Wf5mYoJbsgABUF9P\n' \
'![https://coggle.it/diagram/Wf5mYoJbsgABUF9P](Neural_Net_Arch_Genealogy.png)\n' \
'## Text Version\n' \
'This is automatically generated. Please send a PR on the `Neural Net Arch Genealogy.txt` file.\n'
tail = '\n## Contributions\nYour pull requests and issues are always welcome.' \
with open('Neural Net Arch Genealogy.txt') as fin, open('README.md', 'w') as fout:
fout.write(head)
for line in fin:
tab_count = line.count('\t')
if not tab_count:
continue
spaces = [' ' for i in range(tab_count-1)]
fout.write(''.join(spaces) + '* ' + line.replace('\t', ''))
fout.write(tail)