forked from lzhbrian/Cool-Fashion-Papers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_readme.py
95 lines (70 loc) Β· 2.42 KB
/
generate_readme.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import pandas as pd
def generate_one_table(df, fp):
df = df.sort_values(['date', 'paper_link'], ascending=False).reset_index(drop=True)
print('| Model | Title | Publication | Paper | Link |', file=fp)
print('| ----- | ----- | ----------- | ----- | ---- |', file=fp)
length = len(df['date'])
for i in range(length):
inst = df.loc[i]
model = inst['model'] if not pd.isna(inst['model']) else ''
pub = 'arXiv' if pd.isna(inst['publication']) else inst['publication']
paper = '[[paper]](%s)' % inst['paper_link']
if 'arxiv' in inst['paper_link']:
paper = '[[%s]](%s)' % (inst['paper_link'].split('/')[-1], inst['paper_link'])
project = '[[project]](%s)' % inst['project_link'] if not pd.isna(inst['project_link']) else ''
if project and 'github.com' in inst['project_link']:
parts = inst['project_link'].split('/')
project = '[[%s]](%s)' % (' / '.join([parts[-2], parts[-1]]), inst['project_link'])
output_str = '| %s | %s | %s | %s | %s |' % (
model,
inst['title'],
pub,
paper,
project
)
print(output_str, file=fp)
def papers(fp, file_list):
print('## Papers', file=fp)
for filename in file_list:
print(filename)
df = pd.read_csv('data/' + filename)
print('### %s' % (filename.split('.')[0]), file=fp)
generate_one_table(df, fp)
print('\n\n', file=fp)
if __name__ == '__main__':
fp = open('README.md', 'w')
# title
print('# Cool Fashion Papers πππΆοΈπ©', file=fp)
## Brief
talk = '__Cool Fashion Related Papers and Resources (companies, datasets, conference, workshops, ...).__\n\n' \
'Papers are ordered in arXiv first version submitting time (if applicable).\n\n' \
'Feel free to send a PR or issue.\n\n'
print(talk, file=fp)
## TOC
for line in open('toc.md').readlines():
print(line, file=fp, end='')
print('\n\n', file=fp)
## Papers
file_list = ['Synthesis.csv',
'Classification.csv',
'Recommendation.csv',
'Forecast.csv']
papers(fp, file_list)
print('\n\n', file=fp)
## Event
for line in open('event.md').readlines():
print(line, file=fp, end='')
print('\n\n', file=fp)
## Dataset
for line in open('dataset.md').readlines():
print(line, file=fp, end='')
print('\n\n', file=fp)
## Companies
for line in open('companies.md').readlines():
print(line, file=fp, end='')
print('\n\n', file=fp)
## Other resources
for line in open('others.md').readlines():
print(line, file=fp, end='')
print('\n\n', file=fp)
fp.close()