forked from PaddlePaddle/Paddle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add auto documentation of API Reference (PaddlePaddle#197)
* add API Reference init configuration * Update conf.py * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency * add readthedoc config and dependency
- Loading branch information
1 parent
c8b3cc4
commit fc27ae9
Showing
121 changed files
with
1,589 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# .readthedocs.yaml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
submodules: | ||
include: all | ||
recursive: true | ||
|
||
# Build documentation in the docs/ directory with Sphinx | ||
sphinx: | ||
configuration: docs/conf.py | ||
|
||
# Optionally build your docs in additional formats such as PDF | ||
#formats: | ||
|
||
# Optionally set the version of Python and requirements required to build your docs | ||
python: | ||
version: 3.7 | ||
install: | ||
- requirements: docs/requirements.txt | ||
- requirements: requirements.txt | ||
- method: setuptools | ||
path: . | ||
system_packages: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
============ | ||
API Reference | ||
============ | ||
.. automodule:: paddlenlp | ||
:members: | ||
:inherited-members: | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:maxdepth: 2 | ||
:caption: paddlenlp | ||
|
||
/api_reference/data.rst | ||
/api_reference/layer.rst | ||
/api_reference/train_evaluate.rst | ||
/api_reference/predict.rst | ||
/api_reference/others.rst | ||
|
||
|
||
参考:https://www.paddlepaddle.org.cn/documentation/docs/zh/2.0-rc/api/index_cn.html | ||
paddlenlp.data <source/paddlenlp.data> | ||
paddlenlp.datasets <source/paddlenlp.datasets> | ||
paddlenlp.embeddings <source/paddlenlp.embeddings> | ||
paddlenlp.layers <source/paddlenlp.layers> | ||
paddlenlp.metrics <source/paddlenlp.metrics> | ||
paddlenlp.seq2vec <source/paddlenlp.seq2vec> | ||
paddlenlp.transformers <source/paddlenlp.transformers> | ||
paddlenlp.utils <source/paddlenlp.utils> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import os | ||
import re | ||
|
||
|
||
def modify_doc_title_dir(abspath_rstfiles_dir): | ||
""" | ||
rst文件中:有‘========’和‘----------’行的表示其行上一行的文字是标题, | ||
‘=’和‘-’要大于等于标题的长度。 | ||
使用sphinx-apidoc -o ./source/rst_files /home/myubuntu/pro/mypro命令将 | ||
生成rst文件放在./source/rst_files目录下, 执行sphinx-quickstart命令生成的 | ||
index.rst不用放到这个目录中。 或在source目录下新建 | ||
rst_files目录然后将rst文件剪切到这个目录下,修改后再剪切出来 | ||
生成rst文件后将rst_files/modules.rst文件中的标题去掉,并修改maxdepth字段。 | ||
删除和修改使用sphinx-apidoc -o 命令的生成的rst文件中的标题 | ||
:param abspath_rstfiles_dir: rst文件所在的文件夹的绝对路径 | ||
:return: | ||
""" | ||
rst_files = os.listdir(abspath_rstfiles_dir) | ||
# 要删除的节点(标题目录的节点) | ||
del_nodes = ['Submodules', 'Module contents', 'Subpackages'] | ||
# 要删除的标题中的字符串 | ||
del_str = [' module', ' package'] | ||
for rst_file in rst_files: | ||
f = open(os.path.join(abspath_rstfiles_dir, rst_file), 'r') | ||
file_lines = f.readlines() | ||
f.close() | ||
write_con = [] | ||
flag = 0 | ||
for file_line in file_lines: | ||
if file_line.strip() in del_nodes: | ||
flag = 1 | ||
continue | ||
if flag: | ||
flag = 0 | ||
continue | ||
if re.search(del_str[0], file_line): | ||
modify_line = file_line.split('.')[-1].replace(del_str[0], '') | ||
write_con.append(modify_line) | ||
continue | ||
if re.search(del_str[1], file_line): | ||
modify_line = file_line.split('.')[-1].replace(del_str[1], '') | ||
write_con.append(modify_line) | ||
continue | ||
file_line = file_line.replace('undoc-members', 'no-undoc-members') | ||
write_con.append(file_line) | ||
f = open(os.path.join(abspath_rstfiles_dir, rst_file), 'w') | ||
f.writelines(write_con) | ||
f.close() | ||
|
||
|
||
if __name__ == '__main__': | ||
modify_doc_title_dir('./source') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,42 @@ | ||
.. nlp-practice documentation master file, created by | ||
sphinx-quickstart on Wed Nov 18 15:57:54 2020. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
欢迎使用PaddleNLP | ||
======================================== | ||
PaddleNLP是基于飞桨框架的NLP领域最佳实践,集成了丰富的数据集、网络结构、预训练模型、评价指标、数据处理等通用功能。具备......等特性。 | ||
================== | ||
`PaddleNLP <https://github.com/PaddlePaddle/PaddleNLP>`_ 是基于飞桨框架的NLP领域最佳实践, | ||
集成了丰富的数据集、网络结构、预训练模型、评价指标、数据处理等通用功能。具备......等特性。 | ||
|
||
* 项目GitHub: https://github.com/PaddlePaddle/PaddleNLP | ||
* 官方QQ用户群: 973379845 | ||
* GitHub Issue反馈: https://github.com/PaddlePaddle/PaddleNLP/issues | ||
* 官方QQ用户群: 973379845 | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: 快速开始 | ||
|
||
安装 <get_started/installation> | ||
10分钟完成高精度中文情感分析 <get_started/quick_start> | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
PaddleNLP是什么 <paddlenlp> | ||
快速开始 <get_started> | ||
数据准备 <data_prepare> | ||
模型库 <model_zoo> | ||
实践教程 <tutorials> | ||
进阶指南 <advanced_guide> | ||
API Reference <api_reference> | ||
社区贡献 <community> | ||
FAQ <faq> | ||
版本更新 <version> | ||
|
||
.. Indices and tables | ||
.. ================== | ||
.. * :ref:`genindex` | ||
.. * :ref:`modindex` | ||
.. * :ref:`search` | ||
:caption: 数据准备 | ||
|
||
整体介绍 <data_prepare/overview> | ||
数据集列表 <data_prepare/dataset_list> | ||
加载数据集 <data_prepare/dataset_load> | ||
自定义数据集 <data_prepare/dataset_self_defined> | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: 实践教程 | ||
|
||
tutorials | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: API Reference | ||
|
||
api_reference | ||
|
||
Indices and tables | ||
==================== | ||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Defining the exact version will make sure things don't break | ||
|
||
sphinx==3.5.2 | ||
sphinx_rtd_theme==0.5.1 | ||
readthedocs-sphinx-search==0.1.0 | ||
|
||
sphinx-copybutton==0.3.1 | ||
sphinx-markdown-tables==0.0.15 | ||
|
||
paddlepaddle >= 2.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
paddlenlp | ||
========= | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
paddlenlp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
collate | ||
============================= | ||
|
||
.. automodule:: paddlenlp.data.collate | ||
:members: | ||
:no-undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
iterator | ||
============================== | ||
|
||
.. automodule:: paddlenlp.data.iterator | ||
:members: | ||
:no-undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
data | ||
====================== | ||
|
||
.. automodule:: paddlenlp.data | ||
:members: | ||
:no-undoc-members: | ||
:show-inheritance: | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
paddlenlp.data.collate | ||
paddlenlp.data.iterator | ||
paddlenlp.data.sampler | ||
paddlenlp.data.tokenizer | ||
paddlenlp.data.vocab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
sampler | ||
============================= | ||
|
||
.. automodule:: paddlenlp.data.sampler | ||
:members: | ||
:no-undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tokenizer | ||
=============================== | ||
|
||
.. automodule:: paddlenlp.data.tokenizer | ||
:members: | ||
:no-undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
vocab | ||
=========================== | ||
|
||
.. automodule:: paddlenlp.data.vocab | ||
:members: | ||
:no-undoc-members: | ||
:show-inheritance: |
Oops, something went wrong.