-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcli.py
More file actions
31 lines (27 loc) · 885 Bytes
/
Copy pathcli.py
File metadata and controls
31 lines (27 loc) · 885 Bytes
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
from pprint import pprint
import pandas as pd
from sagas.conf.conf import cf
class AugmentorCli(object):
def chapters(self, lang='zh'):
"""
$ python -m augmentor.cli chapters
:param lang:
:return:
"""
dfjson = pd.read_json(f'{cf.conf_dir}/stack/crawlers/langcrs/all_{lang}.json')
del dfjson['audio']
for name, group in dfjson.groupby('chapter'):
print(f"`{name}`")
del group['chapter']
print(group)
def chapter_titles(self, lang='zh'):
"""
$ python -m augmentor.cli chapter_titles
:return:
"""
dfjson = pd.read_json(f'{cf.conf_dir}/stack/crawlers/langcrs/all_{lang}.json')
names= [name for name, group in dfjson.groupby('chapter')]
pprint(names)
if __name__ == '__main__':
import fire
fire.Fire(AugmentorCli)