-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from fastnlp/dev0.5.0
Dev0.5.0 Update
- Loading branch information
Showing
287 changed files
with
11,847 additions
and
6,783 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
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
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,65 @@ | ||
import os | ||
import sys | ||
|
||
|
||
def find_all_modules(): | ||
modules = {} | ||
children = {} | ||
to_doc = set() | ||
root = '../fastNLP' | ||
for path, dirs, files in os.walk(root): | ||
for file in files: | ||
if file.endswith('.py'): | ||
name = ".".join(path.split('/')[1:]) | ||
if file.split('.')[0] != "__init__": | ||
name = name + '.' + file.split('.')[0] | ||
__import__(name) | ||
m = sys.modules[name] | ||
modules[name] = m | ||
try: | ||
m.__all__ | ||
except: | ||
print(name, "__all__ missing") | ||
continue | ||
if m.__doc__ is None: | ||
print(name, "__doc__ missing") | ||
continue | ||
if "undocumented" not in m.__doc__: | ||
to_doc.add(name) | ||
for module in to_doc: | ||
t = ".".join(module.split('.')[:-1]) | ||
if t in to_doc: | ||
if t not in children: | ||
children[t] = set() | ||
children[t].add(module) | ||
for m in children: | ||
children[m] = sorted(children[m]) | ||
return modules, to_doc, children | ||
|
||
|
||
def create_rst_file(modules, name, children): | ||
m = modules[name] | ||
with open("./source/" + name + ".rst", "w") as fout: | ||
t = "=" * len(name) | ||
fout.write(name + "\n") | ||
fout.write(t + "\n") | ||
fout.write("\n") | ||
fout.write(".. automodule:: " + name + "\n") | ||
if len(m.__all__) > 0: | ||
fout.write(" :members: " + ", ".join(m.__all__) + "\n") | ||
fout.write(" :inherited-members:\n") | ||
fout.write("\n") | ||
if name in children: | ||
fout.write("子模块\n------\n\n.. toctree::\n\n") | ||
for module in children[name]: | ||
fout.write(" " + module + "\n") | ||
|
||
|
||
def main(): | ||
modules, to_doc, children = find_all_modules() | ||
for name in to_doc: | ||
create_rst_file(modules, name, children) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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
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
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
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
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
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
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
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
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 @@ | ||
fastNLP.embeddings.bert_embedding | ||
================================= | ||
|
||
.. automodule:: fastNLP.embeddings.bert_embedding | ||
:members: BertEmbedding, BertWordPieceEncoder | ||
:inherited-members: | ||
|
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 @@ | ||
fastNLP.embeddings.char_embedding | ||
================================= | ||
|
||
.. automodule:: fastNLP.embeddings.char_embedding | ||
:members: CNNCharEmbedding, LSTMCharEmbedding | ||
:inherited-members: | ||
|
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 @@ | ||
fastNLP.embeddings.contextual_embedding | ||
======================================= | ||
|
||
.. automodule:: fastNLP.embeddings.contextual_embedding | ||
:members: ContextualEmbedding | ||
:inherited-members: | ||
|
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 @@ | ||
fastNLP.embeddings.elmo_embedding | ||
================================= | ||
|
||
.. automodule:: fastNLP.embeddings.elmo_embedding | ||
:members: ElmoEmbedding | ||
:inherited-members: | ||
|
Oops, something went wrong.