-
-
Notifications
You must be signed in to change notification settings - Fork 333
/
tmp_api.py
executable file
·65 lines (50 loc) · 1.38 KB
/
tmp_api.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pathlib
import sys
import traceback
import kglab # pylint: disable=E0401,W0611
import rdflib # pylint: disable=E0401,W0611
from mkrefs import PackageDoc # pylint: disable=E0401
from mkrefs.util import render_reference # pylint: disable=E0401
if __name__ == "__main__":
package_name = "pytextrank"
git_url = "https://github.com/DerwenAI/pytextrank/blob/main"
includes = [
"BaseTextRankFactory",
"BaseTextRank",
"PositionRankFactory",
"PositionRank",
"BiasedTextRankFactory",
"BiasedTextRank",
"Lemma",
"Paragraph",
"Phrase",
"Sentence",
"VectorElem",
]
pkg_doc = PackageDoc(
package_name,
git_url,
includes,
)
try:
pkg_doc.build()
# render the JSON into Markdown using the Jinja2 template
groups = {
"package": [ pkg_doc.meta ],
}
print(groups)
template_path = pathlib.Path("docs/ref.jinja")
markdown_path = pathlib.Path("docs/ref.md")
render_reference(
template_path,
markdown_path,
groups,
)
sys.exit(0)
# show results
kg = pkg_doc.get_rdf()
print(kg.save_rdf_text())
except Exception: # pylint: disable=W0703
traceback.print_exc()