add docs
This commit is contained in:
parent
009dd3a488
commit
c0e0b4cdfb
|
@ -0,0 +1,20 @@
|
||||||
|
# Minimal makefile for Sphinx documentation
|
||||||
|
#
|
||||||
|
|
||||||
|
# You can set these variables from the command line, and also
|
||||||
|
# from the environment for the first two.
|
||||||
|
SPHINXOPTS ?=
|
||||||
|
SPHINXBUILD ?= sphinx-build
|
||||||
|
SOURCEDIR = source
|
||||||
|
BUILDDIR = build
|
||||||
|
|
||||||
|
# Put it first so that "make" without argument is like "make help".
|
||||||
|
help:
|
||||||
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
|
.PHONY: help Makefile
|
||||||
|
|
||||||
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||||
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||||
|
%: Makefile
|
||||||
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@ -0,0 +1,35 @@
|
||||||
|
@ECHO OFF
|
||||||
|
|
||||||
|
pushd %~dp0
|
||||||
|
|
||||||
|
REM Command file for Sphinx documentation
|
||||||
|
|
||||||
|
if "%SPHINXBUILD%" == "" (
|
||||||
|
set SPHINXBUILD=sphinx-build
|
||||||
|
)
|
||||||
|
set SOURCEDIR=source
|
||||||
|
set BUILDDIR=build
|
||||||
|
|
||||||
|
if "%1" == "" goto help
|
||||||
|
|
||||||
|
%SPHINXBUILD% >NUL 2>NUL
|
||||||
|
if errorlevel 9009 (
|
||||||
|
echo.
|
||||||
|
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||||
|
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||||
|
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||||
|
echo.may add the Sphinx directory to PATH.
|
||||||
|
echo.
|
||||||
|
echo.If you don't have Sphinx installed, grab it from
|
||||||
|
echo.https://www.sphinx-doc.org/
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:help
|
||||||
|
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||||
|
|
||||||
|
:end
|
||||||
|
popd
|
Binary file not shown.
After Width: | Height: | Size: 104 KiB |
|
@ -0,0 +1,118 @@
|
||||||
|
a,
|
||||||
|
.wy-menu-vertical header,
|
||||||
|
.wy-menu-vertical p.caption,
|
||||||
|
.wy-nav-top .fa-bars,
|
||||||
|
.wy-menu-vertical a:hover,
|
||||||
|
|
||||||
|
.rst-content code.literal, .rst-content tt.literal
|
||||||
|
|
||||||
|
{
|
||||||
|
color: rgb(0, 63, 136) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* inspired by sphinx press theme */
|
||||||
|
.wy-menu.wy-menu-vertical li.toctree-l1.current > a {
|
||||||
|
border-left: solid 8px #4122f0 !important;
|
||||||
|
border-top: none;
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wy-menu.wy-menu-vertical li.toctree-l1.current > ul {
|
||||||
|
border-left: solid 8px #4719ee !important;
|
||||||
|
}
|
||||||
|
/* inspired by sphinx press theme */
|
||||||
|
|
||||||
|
.wy-nav-side {
|
||||||
|
color: unset !important;
|
||||||
|
background: unset !important;
|
||||||
|
border-right: solid 1px #ccc !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wy-side-nav-search,
|
||||||
|
.wy-nav-top,
|
||||||
|
.wy-menu-vertical li,
|
||||||
|
.wy-menu-vertical li a:hover,
|
||||||
|
.wy-menu-vertical li a
|
||||||
|
{
|
||||||
|
background: unset !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wy-menu-vertical li.current a {
|
||||||
|
border-right: unset !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wy-side-nav-search div,
|
||||||
|
.wy-menu-vertical a {
|
||||||
|
color: #404040 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wy-menu-vertical button.toctree-expand {
|
||||||
|
color: #333 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wy-nav-content {
|
||||||
|
max-width: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rst-content {
|
||||||
|
max-width: 900px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wy-nav-content .icon-home:before {
|
||||||
|
content: "Docs";
|
||||||
|
}
|
||||||
|
|
||||||
|
.wy-side-nav-search .icon-home:before {
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.field-list {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.field-list > dt:after {
|
||||||
|
content: "" !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.field-list > dt {
|
||||||
|
display: table;
|
||||||
|
padding-left: 6px !important;
|
||||||
|
padding-right: 6px !important;
|
||||||
|
margin-bottom: 4px !important;
|
||||||
|
padding-bottom: 1px !important;
|
||||||
|
background: #f6ecd852;
|
||||||
|
border-left: solid 2px #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dl.py.class>dt
|
||||||
|
{
|
||||||
|
color: rgba(17, 16, 17, 0.822) !important;
|
||||||
|
background: rgb(226, 241, 250) !important;
|
||||||
|
border-top: solid 2px #58b5cc !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.py.method>dt
|
||||||
|
{
|
||||||
|
background: rgb(226, 241, 250) !important;
|
||||||
|
border-left: solid 2px #bcb3be !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.py.attribute>dt,
|
||||||
|
dl.py.property>dt
|
||||||
|
{
|
||||||
|
background: rgb(226, 241, 250) !important;
|
||||||
|
border-left: solid 2px #58b5cc !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-plus-square-o::before, .wy-menu-vertical li button.toctree-expand::before,
|
||||||
|
.fa-minus-square-o::before, .wy-menu-vertical li.current > a button.toctree-expand::before, .wy-menu-vertical li.on a button.toctree-expand::before
|
||||||
|
{
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
|
|
||||||
|
.rst-content .viewcode-back,
|
||||||
|
.rst-content .viewcode-link
|
||||||
|
{
|
||||||
|
font-size: 120%;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 419 KiB |
Binary file not shown.
After Width: | Height: | Size: 207 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
|
@ -0,0 +1,82 @@
|
||||||
|
# Configuration file for the Sphinx documentation builder.
|
||||||
|
#
|
||||||
|
# This file only contains a selection of the most common options. For a full
|
||||||
|
# list see the documentation:
|
||||||
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||||
|
|
||||||
|
# -- Path setup --------------------------------------------------------------
|
||||||
|
|
||||||
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
|
#
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
sys.path.insert(0, os.path.abspath('../../src'))
|
||||||
|
import sphinx_rtd_theme
|
||||||
|
import doctest
|
||||||
|
import deepke
|
||||||
|
# -- Project information -----------------------------------------------------
|
||||||
|
|
||||||
|
project = 'DeepKE'
|
||||||
|
copyright = '2021, ZJUNLP'
|
||||||
|
author = 'tlk'
|
||||||
|
|
||||||
|
# The full version, including alpha/beta/rc tags
|
||||||
|
release = '1.0.0'
|
||||||
|
|
||||||
|
|
||||||
|
# -- General configuration ---------------------------------------------------
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
|
# ones.
|
||||||
|
extensions = [
|
||||||
|
'sphinx.ext.autodoc',
|
||||||
|
'sphinx.ext.autosummary',
|
||||||
|
'sphinx.ext.doctest',
|
||||||
|
'sphinx.ext.intersphinx',
|
||||||
|
'sphinx.ext.mathjax',
|
||||||
|
'sphinx.ext.napoleon',
|
||||||
|
'sphinx.ext.viewcode',
|
||||||
|
'sphinx.ext.githubpages',
|
||||||
|
'sphinx.ext.todo',
|
||||||
|
'sphinx.ext.coverage',
|
||||||
|
'sphinx_copybutton',
|
||||||
|
]
|
||||||
|
|
||||||
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
templates_path = ['_templates']
|
||||||
|
|
||||||
|
# List of patterns, relative to source directory, that match files and
|
||||||
|
# directories to ignore when looking for source files.
|
||||||
|
# This pattern also affects html_static_path and html_extra_path.
|
||||||
|
exclude_patterns = []
|
||||||
|
|
||||||
|
doctest_default_flags = doctest.NORMALIZE_WHITESPACE
|
||||||
|
autodoc_member_order = 'bysource'
|
||||||
|
intersphinx_mapping = {'python': ('https://docs.python.org/', None)}
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for HTML output -------------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
|
# a list of builtin themes.
|
||||||
|
#
|
||||||
|
html_theme = 'sphinx_rtd_theme'
|
||||||
|
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||||
|
|
||||||
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
|
html_static_path = ['_static']
|
||||||
|
html_css_files = ['css/custom.css']
|
||||||
|
# html_logo = './_static/logo.png'
|
||||||
|
|
||||||
|
html_context = {
|
||||||
|
"display_github": True, # Integrate GitHub
|
||||||
|
"github_user": "tlk1997", # Username
|
||||||
|
"github_repo": "test_doc", # Repo name
|
||||||
|
"github_version": "main", # Version
|
||||||
|
"conf_py_path": "/docs/source/", # Path in the checkout to the docs root
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
Attribution Extraction
|
||||||
|
======================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 4
|
||||||
|
|
||||||
|
deepke.attribution_extraction.standard
|
|
@ -0,0 +1,60 @@
|
||||||
|
Models
|
||||||
|
======
|
||||||
|
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.models.BasicModule module
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.models.BasicModule
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.models.BiLSTM module
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.models.BiLSTM
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.models.Capsule module
|
||||||
|
-------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.models.Capsule
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.models.GCN module
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.models.GCN
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.models.LM module
|
||||||
|
--------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.models.LM
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.models.PCNN module
|
||||||
|
----------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.models.PCNN
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.models.Transformer module
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.models.Transformer
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
Module
|
||||||
|
======
|
||||||
|
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.module.Attention module
|
||||||
|
---------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.module.Attention
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.module.CNN module
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.module.CNN
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.module.Capsule module
|
||||||
|
-------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.module.Capsule
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.module.Embedding module
|
||||||
|
---------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.module.Embedding
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.module.GCN module
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.module.GCN
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.module.RNN module
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.module.RNN
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.module.Transformer module
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.module.Transformer
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
Standard
|
||||||
|
========
|
||||||
|
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 4
|
||||||
|
|
||||||
|
deepke.attribution_extraction.standard.models
|
||||||
|
deepke.attribution_extraction.standard.module
|
||||||
|
deepke.attribution_extraction.standard.tools
|
||||||
|
deepke.attribution_extraction.standard.utils
|
|
@ -0,0 +1,53 @@
|
||||||
|
Tools
|
||||||
|
=====
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.tools.dataset module
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.tools.dataset
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.tools.metrics module
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.tools.metrics
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.tools.preprocess module
|
||||||
|
---------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.tools.preprocess
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.tools.serializer module
|
||||||
|
---------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.tools.serializer
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.tools.trainer module
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.tools.trainer
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.tools.vocab module
|
||||||
|
----------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.tools.vocab
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
Utils
|
||||||
|
=====
|
||||||
|
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.utils.ioUtils module
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.utils.ioUtils
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.attribution\_extraction.standard.utils.nnUtils module
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.attribution_extraction.standard.utils.nnUtils
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
Models
|
||||||
|
======
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
deepke.name\_entity\_recognition.few\_shot.models.model module
|
||||||
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.name_entity_recognition.few_shot.models.model
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.name\_entity\_recognition.few\_shot.models.modeling\_bart module
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.name_entity_recognition.few_shot.models.modeling_bart
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
Module
|
||||||
|
======
|
||||||
|
|
||||||
|
deepke.name\_entity\_recognition.few\_shot.module.datasets module
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.name_entity_recognition.few_shot.module.datasets
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.name\_entity\_recognition.few\_shot.module.mapping\_type module
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.name_entity_recognition.few_shot.module.mapping_type
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.name\_entity\_recognition.few\_shot.module.metrics module
|
||||||
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.name_entity_recognition.few_shot.module.metrics
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.name\_entity\_recognition.few\_shot.module.train module
|
||||||
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.name_entity_recognition.few_shot.module.train
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
Few Shot
|
||||||
|
========
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 4
|
||||||
|
|
||||||
|
deepke.name_entity_recognition.few_shot.models
|
||||||
|
deepke.name_entity_recognition.few_shot.module
|
||||||
|
deepke.name_entity_recognition.few_shot.utils
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
Utils
|
||||||
|
=====
|
||||||
|
|
||||||
|
deepke.name\_entity\_recognition.few\_shot.utils.util module
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.name_entity_recognition.few_shot.utils.util
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
Name Entity Recognition
|
||||||
|
=======================
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 4
|
||||||
|
|
||||||
|
deepke.name_entity_recognition.few_shot
|
||||||
|
deepke.name_entity_recognition.standard
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
Models
|
||||||
|
======
|
||||||
|
|
||||||
|
deepke.name\_entity\_recognition.standard.models.InferBert module
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.name_entity_recognition.standard.models.InferBert
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
Standard
|
||||||
|
========
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 4
|
||||||
|
|
||||||
|
deepke.name_entity_recognition.standard.models
|
||||||
|
deepke.name_entity_recognition.standard.tools
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
Tools
|
||||||
|
=====
|
||||||
|
|
||||||
|
deepke.name\_entity\_recognition.standard.tools.dataset module
|
||||||
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.name_entity_recognition.standard.tools.dataset
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.name\_entity\_recognition.standard.tools.preprocess module
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.name_entity_recognition.standard.tools.preprocess
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
Document
|
||||||
|
========
|
||||||
|
|
||||||
|
deepke.relation\_extraction.document.evaluation module
|
||||||
|
------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.document.evaluation
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.document.losses module
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.document.losses
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.document.model module
|
||||||
|
-------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.document.model
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.document.module module
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.document.module
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.document.prepro module
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.document.prepro
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.document.utils module
|
||||||
|
-------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.document.utils
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
Dataset
|
||||||
|
=======
|
||||||
|
|
||||||
|
deepke.relation\_extraction.few\_shot.dataset.base\_data\_module module
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.few_shot.dataset.base_data_module
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.few\_shot.dataset.dialogue module
|
||||||
|
-------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.few_shot.dataset.dialogue
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.few\_shot.dataset.processor module
|
||||||
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.few_shot.dataset.processor
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
|
@ -0,0 +1,27 @@
|
||||||
|
Lit Models
|
||||||
|
==========
|
||||||
|
|
||||||
|
deepke.relation\_extraction.few\_shot.lit\_models.base module
|
||||||
|
-------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.few_shot.lit_models.base
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.few\_shot.lit\_models.transformer module
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.few_shot.lit_models.transformer
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.few\_shot.lit\_models.util module
|
||||||
|
-------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.few_shot.lit_models.util
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
Few Shot
|
||||||
|
========
|
||||||
|
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 4
|
||||||
|
|
||||||
|
deepke.relation_extraction.few_shot.dataset
|
||||||
|
deepke.relation_extraction.few_shot.lit_models
|
||||||
|
|
||||||
|
|
||||||
|
deepke.relation\_extraction.few\_shot.generate\_k\_shot module
|
||||||
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.few_shot.generate_k_shot
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.few\_shot.get\_label\_word module
|
||||||
|
-------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.few_shot.get_label_word
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
Relation Extraction
|
||||||
|
===================
|
||||||
|
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 4
|
||||||
|
|
||||||
|
deepke.relation_extraction.document
|
||||||
|
deepke.relation_extraction.few_shot
|
||||||
|
deepke.relation_extraction.standard
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
Models
|
||||||
|
======
|
||||||
|
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.models.BasicModule module
|
||||||
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.models.BasicModule
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.models.BiLSTM module
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.models.BiLSTM
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.models.Capsule module
|
||||||
|
----------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.models.Capsule
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.models.GCN module
|
||||||
|
------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.models.GCN
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.models.LM module
|
||||||
|
-----------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.models.LM
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.models.PCNN module
|
||||||
|
-------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.models.PCNN
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.models.Transformer module
|
||||||
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.models.Transformer
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
|
@ -0,0 +1,59 @@
|
||||||
|
Module
|
||||||
|
======
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.module.Attention module
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.module.Attention
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.module.CNN module
|
||||||
|
------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.module.CNN
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.module.Capsule module
|
||||||
|
----------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.module.Capsule
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.module.Embedding module
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.module.Embedding
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.module.GCN module
|
||||||
|
------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.module.GCN
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.module.RNN module
|
||||||
|
------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.module.RNN
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.module.Transformer module
|
||||||
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.module.Transformer
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
Standard
|
||||||
|
========
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 4
|
||||||
|
|
||||||
|
deepke.relation_extraction.standard.models
|
||||||
|
deepke.relation_extraction.standard.module
|
||||||
|
deepke.relation_extraction.standard.tools
|
||||||
|
deepke.relation_extraction.standard.utils
|
|
@ -0,0 +1,60 @@
|
||||||
|
Tools
|
||||||
|
=====
|
||||||
|
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.tools.dataset module
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.tools.dataset
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.tools.loss module
|
||||||
|
------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.tools.loss
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.tools.metrics module
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.tools.metrics
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.tools.preprocess module
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.tools.preprocess
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.tools.serializer module
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.tools.serializer
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.tools.trainer module
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.tools.trainer
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.tools.vocab module
|
||||||
|
-------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.tools.vocab
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
Utils
|
||||||
|
=====
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.utils.ioUtils module
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.utils.ioUtils
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
deepke.relation\_extraction.standard.utils.nnUtils module
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: deepke.relation_extraction.standard.utils.nnUtils
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
DeepKE
|
||||||
|
======
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 4
|
||||||
|
|
||||||
|
deepke.attribution_extraction
|
||||||
|
deepke.name_entity_recognition
|
||||||
|
deepke.relation_extraction
|
||||||
|
|
|
@ -0,0 +1,345 @@
|
||||||
|
Example
|
||||||
|
=======
|
||||||
|
|
||||||
|
Standard NER
|
||||||
|
------------
|
||||||
|
The standard module is implemented by the pretrained model BERT.
|
||||||
|
|
||||||
|
**Step 1**
|
||||||
|
|
||||||
|
Enter ``DeepKE/example/ner/standard`` .
|
||||||
|
|
||||||
|
**Step 2**
|
||||||
|
|
||||||
|
Get data:
|
||||||
|
|
||||||
|
`wget 120.27.214.45/Data/ner/standard/data.tar.gz`
|
||||||
|
|
||||||
|
`tar -xzvf data.tar.gz`
|
||||||
|
|
||||||
|
The dataset and parameters can be customized in the ``data`` folder and ``conf`` folder respectively.
|
||||||
|
|
||||||
|
Dataset needs to be input as ``TXT`` file
|
||||||
|
|
||||||
|
The `data's format` of file needs to comply with the following:
|
||||||
|
|
||||||
|
杭 B-LOC '\\n'
|
||||||
|
州 I-LOC '\\n'
|
||||||
|
真 O '\\n'
|
||||||
|
美 O '\\n'
|
||||||
|
|
||||||
|
**Step 3**
|
||||||
|
|
||||||
|
Train:
|
||||||
|
|
||||||
|
`python run.py`
|
||||||
|
|
||||||
|
**Step 4**
|
||||||
|
|
||||||
|
Predict:
|
||||||
|
|
||||||
|
`python predict.py`
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd example/ner/standard
|
||||||
|
|
||||||
|
wget 120.27.214.45/Data/ner/standard/data.tar.gz
|
||||||
|
|
||||||
|
tar -xzvf data.tar.gz
|
||||||
|
|
||||||
|
python run.py
|
||||||
|
|
||||||
|
python predict.py
|
||||||
|
|
||||||
|
Few-shot NER
|
||||||
|
------------
|
||||||
|
This module is in the low-resouce scenario.
|
||||||
|
|
||||||
|
**Step 1**
|
||||||
|
|
||||||
|
Enter ``DeepKE/example/ner/few-shot`` .
|
||||||
|
|
||||||
|
**Step 2**
|
||||||
|
|
||||||
|
Get data:
|
||||||
|
|
||||||
|
`wget 120.27.214.45/Data/ner/few_shot/data.tar.gz`
|
||||||
|
|
||||||
|
`tar -xzvf data.tar.gz`
|
||||||
|
|
||||||
|
The directory where the model is loaded and saved and the configuration parameters can be cusomized in the ``conf`` folder.The dataset can be customized in the ``data`` folder.
|
||||||
|
|
||||||
|
Dataset needs to be input as ``TXT`` file
|
||||||
|
|
||||||
|
The `data's format` of file needs to comply with the following:
|
||||||
|
|
||||||
|
EU B-ORG '\\n'
|
||||||
|
rejects O '\\n'
|
||||||
|
German B-MISC '\\n'
|
||||||
|
call O '\\n'
|
||||||
|
to O '\\n'
|
||||||
|
boycott O '\\n'
|
||||||
|
British B-MISC '\\n'
|
||||||
|
lamb O '\\n'
|
||||||
|
. O '\\n'
|
||||||
|
|
||||||
|
**Step 3**
|
||||||
|
|
||||||
|
Train with CoNLL-2003:
|
||||||
|
|
||||||
|
`python run.py`
|
||||||
|
|
||||||
|
Train in the few-shot scenario:
|
||||||
|
|
||||||
|
`python run.py +train=few_shot`. Users can modify `load_path` in ``conf/train/few_shot.yaml`` with the use of existing loaded model.
|
||||||
|
|
||||||
|
**Step 4**
|
||||||
|
|
||||||
|
Predict:
|
||||||
|
|
||||||
|
add `- predict` to ``conf/config.yaml`` , modify `loda_path` as the model path and `write_path` as the path where the predicted results are saved in ``conf/predict.yaml`` , and then run `python predict.py`
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd example/ner/few-shot
|
||||||
|
|
||||||
|
wget 120.27.214.45/Data/ner/few_shot/data.tar.gz
|
||||||
|
|
||||||
|
tar -xzvf data.tar.gz
|
||||||
|
|
||||||
|
python run.py
|
||||||
|
|
||||||
|
python predict.py
|
||||||
|
|
||||||
|
Standard RE
|
||||||
|
-----------
|
||||||
|
The standard module is implemented by common deep learning models, including CNN, RNN, Capsule, GCN, Transformer and the pretrained model.
|
||||||
|
|
||||||
|
**Step 1**
|
||||||
|
|
||||||
|
Enter the ``DeepKE/example/re/standard`` folder.
|
||||||
|
|
||||||
|
**Step 2**
|
||||||
|
|
||||||
|
Get data:
|
||||||
|
|
||||||
|
`wget 120.27.214.45/Data/re/standard/data.tar.gz`
|
||||||
|
|
||||||
|
`tar -xzvf data.tar.gz`
|
||||||
|
|
||||||
|
The dataset and parameters can be customized in the ``data`` folder and ``conf`` folder respectively.
|
||||||
|
|
||||||
|
Dataset needs to be input as ``CSV`` file.
|
||||||
|
|
||||||
|
The `data's format` of file needs to comply with the following:
|
||||||
|
|
||||||
|
+--------------------------+-----------+------------+-------------+------------+------------+
|
||||||
|
| Sentence | Relation | Head | Head_offset | Tail | Tail_offset|
|
||||||
|
+--------------------------+-----------+------------+-------------+------------+------------+
|
||||||
|
|
||||||
|
The relation's format of file needs to comply with the following:
|
||||||
|
|
||||||
|
+------------+-----------+------------------+-------------+
|
||||||
|
| Head_type | Tail_type | relation | Index |
|
||||||
|
+------------+-----------+------------------+-------------+
|
||||||
|
|
||||||
|
|
||||||
|
**Step 3**
|
||||||
|
|
||||||
|
Train:
|
||||||
|
|
||||||
|
`python run.py`
|
||||||
|
|
||||||
|
**Step 4**
|
||||||
|
|
||||||
|
Predict:
|
||||||
|
|
||||||
|
`python predict.py`
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd example/re/standard
|
||||||
|
|
||||||
|
wget 120.27.214.45/Data/re/standard/data.tar.gz
|
||||||
|
|
||||||
|
tar -xzvf data.tar.gz
|
||||||
|
|
||||||
|
python run.py
|
||||||
|
|
||||||
|
python predict.py
|
||||||
|
|
||||||
|
Few-shot RE
|
||||||
|
-----------
|
||||||
|
This module is in the low-resouce scenario.
|
||||||
|
|
||||||
|
**Step 1**
|
||||||
|
|
||||||
|
Enter ``DeepKE/example/re/few-shot`` .
|
||||||
|
|
||||||
|
**Step 2**
|
||||||
|
|
||||||
|
Get data:
|
||||||
|
|
||||||
|
`wget 120.27.214.45/Data/re/few_shot/data.tar.gz`
|
||||||
|
|
||||||
|
`tar -xzvf data.tar.gz`
|
||||||
|
|
||||||
|
The dataset and parameters can be customized in the ``data`` folder and ``conf`` folder respectively.
|
||||||
|
|
||||||
|
Dataset needs to be input as ``TXT`` file and ``JSON`` file.
|
||||||
|
|
||||||
|
The `data's format` of file needs to comply with the following:
|
||||||
|
|
||||||
|
{"token": ["the", "most", "common", "audits", "were", "about", "waste", "and", "recycling", "."], "h": {"name": "audits", "pos": [3, 4]}, "t": {"name": "waste", "pos": [6, 7]}, "relation": "Message-Topic(e1,e2)"}
|
||||||
|
|
||||||
|
The relation's format of file needs to comply with the following:
|
||||||
|
|
||||||
|
{"Other": 0 , "Message-Topic(e1,e2)": 1 ... }
|
||||||
|
|
||||||
|
**Step 3**
|
||||||
|
|
||||||
|
Train:
|
||||||
|
|
||||||
|
`python run.py`
|
||||||
|
|
||||||
|
Start with the model trained last time: modify `train_from_saved_model` in ``conf/train.yaml`` as the path where the model trained last time was saved. And the path saving logs generated in training can be customized by ``log_dir``.
|
||||||
|
|
||||||
|
**Step 4**
|
||||||
|
|
||||||
|
Predict:
|
||||||
|
|
||||||
|
`python predict.py`
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd example/re/few-shot
|
||||||
|
|
||||||
|
wget 120.27.214.45/Data/re/few_shot/data.tar.gz
|
||||||
|
|
||||||
|
tar -xzvf data.tar.gz
|
||||||
|
|
||||||
|
python run.py
|
||||||
|
|
||||||
|
python predict.py
|
||||||
|
|
||||||
|
Document RE
|
||||||
|
-----------
|
||||||
|
This module is in the document scenario.
|
||||||
|
|
||||||
|
**Step 1**
|
||||||
|
|
||||||
|
Enter ``DeepKE/example/re/document`` .
|
||||||
|
|
||||||
|
**Step2**
|
||||||
|
|
||||||
|
Get data:
|
||||||
|
|
||||||
|
`wget 120.27.214.45/Data/re/document/data.tar.gz`
|
||||||
|
|
||||||
|
`tar -xzvf data.tar.gz`
|
||||||
|
|
||||||
|
The dataset and parameters can be customized in the ``data`` folder and ``conf`` folder respectively.
|
||||||
|
|
||||||
|
|
||||||
|
Dataset needs to be input as ``JSON`` file
|
||||||
|
|
||||||
|
The `data's format` of file needs to comply with the following:
|
||||||
|
|
||||||
|
[{"vertexSet": [[{"name": "Lark Force", "pos": [0, 2], "sent_id": 0, "type": "ORG"},...]],
|
||||||
|
|
||||||
|
"labels": [{"r": "P607", "h": 1, "t": 3, "evidence": [0]}, ...],
|
||||||
|
|
||||||
|
"title": "Lark Force",
|
||||||
|
|
||||||
|
"sents": [["Lark", "Force", "was", "an", "Australian", "Army", "formation", "established", "in", "March", "1941", "during", "World", "War", "II", "for", "service", "in", "New", "Britain", "and", "New", "Ireland", "."],...}]
|
||||||
|
|
||||||
|
|
||||||
|
The relation's format of file needs to comply with the following:
|
||||||
|
|
||||||
|
{"P1376": 79,"P607": 27,...}
|
||||||
|
|
||||||
|
**Step 3**
|
||||||
|
|
||||||
|
Train:
|
||||||
|
|
||||||
|
`python run.py`
|
||||||
|
|
||||||
|
Start with the model trained last time: modify `train_from_saved_model` in ``conf/train.yaml`` as the path where the model trained last time was saved. And the path saving logs generated in training can be customized by ``log_dir``.
|
||||||
|
|
||||||
|
**Step 4**
|
||||||
|
|
||||||
|
Predict:
|
||||||
|
|
||||||
|
`python predict.py`
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd example/re/document
|
||||||
|
|
||||||
|
wget 120.27.214.45/Data/re/document/data.tar.gz
|
||||||
|
|
||||||
|
tar -xzvf data.tar.gz
|
||||||
|
|
||||||
|
python run.py
|
||||||
|
|
||||||
|
python predict.py
|
||||||
|
|
||||||
|
Standard AE
|
||||||
|
-----------
|
||||||
|
The standard module is implemented by common deep learning models, including CNN, RNN, Capsule, GCN, Transformer and the pretrained model.
|
||||||
|
|
||||||
|
**Step 1**
|
||||||
|
|
||||||
|
Enter the ``DeepKE/example/ae/standard`` folder.
|
||||||
|
|
||||||
|
**Step 2**
|
||||||
|
|
||||||
|
Get data:
|
||||||
|
|
||||||
|
`wget 120.27.214.45/Data/ae/standard/data.tar.gz`
|
||||||
|
|
||||||
|
`tar -xzvf data.tar.gz`
|
||||||
|
|
||||||
|
The dataset and parameters can be customized in the ``data`` folder and ``conf`` folder respectively.
|
||||||
|
|
||||||
|
Dataset needs to be input as ``CSV`` file.
|
||||||
|
|
||||||
|
The `data's format` of file needs to comply with the following:
|
||||||
|
|
||||||
|
+--------------------------+------------+------------+---------------+-------------------+-----------------------+
|
||||||
|
| Sentence | Attribute | Entity | Entity_offset | Attribute_value | Attribute_value_offset|
|
||||||
|
+--------------------------+------------+------------+---------------+-------------------+-----------------------+
|
||||||
|
|
||||||
|
The attribute's format of file needs to comply with the following:
|
||||||
|
|
||||||
|
+-------------------+-------------+
|
||||||
|
| Attribute | Index |
|
||||||
|
+-------------------+-------------+
|
||||||
|
|
||||||
|
**Step 3**
|
||||||
|
|
||||||
|
Train:
|
||||||
|
|
||||||
|
`python run.py`
|
||||||
|
|
||||||
|
**Step 4**
|
||||||
|
|
||||||
|
Predict:
|
||||||
|
|
||||||
|
`python predict.py`
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd example/ae/regular
|
||||||
|
|
||||||
|
wget 120.27.214.45/Data/ae/standard/data.tar.gz
|
||||||
|
|
||||||
|
tar -xzvf data.tar.gz
|
||||||
|
|
||||||
|
python run.py
|
||||||
|
|
||||||
|
python predict.py
|
||||||
|
|
||||||
|
|
||||||
|
More details , you can refer to https://www.bilibili.com/video/BV1n44y1x7iW?spm_id_from=333.999.0.0 .
|
|
@ -0,0 +1,13 @@
|
||||||
|
FAQ
|
||||||
|
===
|
||||||
|
|
||||||
|
|
||||||
|
1.Using nearest mirror, will speed up the installation of Anaconda.
|
||||||
|
|
||||||
|
2.Using nearest mirror, will speed up pip install XXX.
|
||||||
|
|
||||||
|
3.When encountering ModuleNotFoundError: No module named 'past',run pip install future .
|
||||||
|
|
||||||
|
4.It's slow to install the pretrained language models online. Recommend download pretrained models before use and save them in the pretrained folder. Read README.md in every task directory to check the specific requirement for saving pretrained models.
|
||||||
|
|
||||||
|
5.The old version of DeepKE is in the deepke-v1.0 branch. Users can change the branch to use the old version. The old version has been totally transfered to the standard relation extraction (example/re/standard).
|
|
@ -0,0 +1,52 @@
|
||||||
|
|
||||||
|
DeepKE Documentation
|
||||||
|
====================
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
------------
|
||||||
|
|
||||||
|
|
||||||
|
.. image:: ./_static/logo.png
|
||||||
|
|
||||||
|
DeepKE is a knowledge extraction toolkit supporting low-resource and document-level scenarios. It provides three functions based PyTorch, including Named Entity Recognition, Relation Extraciton and Attribute Extraction.
|
||||||
|
|
||||||
|
|
||||||
|
.. image:: ./_static/demo.gif
|
||||||
|
|
||||||
|
Support Weight & Biases
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
.. image:: ./_static/wandb.png
|
||||||
|
|
||||||
|
To achieve automatic hyper-parameters fine-tuning, DeepKE adopts Weight & Biases, a machine learning toolkit for developers to build better models faster.
|
||||||
|
With this toolkit, DeepKE can visualize results and tune hyper-parameters better automatically.
|
||||||
|
The example running files for all functions in the repository support the toolkit and researchers are able to modify the metrics and hyper-parameter configuration as needed.
|
||||||
|
The detailed usage of this toolkit refers to the official document
|
||||||
|
|
||||||
|
Support Notebook Tutorials
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
We provide Google Colab tutorials and jupyter notebooks in the github repository as example implementation of every functions in different scenarios.
|
||||||
|
These tutorials can be run directly and lead developers and researchers to have a whole picture of DeepKE’s application methods.
|
||||||
|
|
||||||
|
You can go colab directly: https://colab.research.google.com/drive/1cM-zbLhEHkje54P0IZENrfe4HaXwZxZc?usp=sharing
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:glob:
|
||||||
|
:maxdepth: 1
|
||||||
|
:caption: Getting Started
|
||||||
|
|
||||||
|
start
|
||||||
|
install
|
||||||
|
example
|
||||||
|
faq
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:glob:
|
||||||
|
:maxdepth: 3
|
||||||
|
:caption: Package
|
||||||
|
|
||||||
|
deepke
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
Install
|
||||||
|
=======
|
||||||
|
|
||||||
|
Create environment
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Create a virtual environment directly (recommend anaconda)
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
conda create -n deepke python=3.8
|
||||||
|
conda activate deepke
|
||||||
|
|
||||||
|
We also provide dockerfile to create docker image.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd docker
|
||||||
|
docker build -t deepke .
|
||||||
|
conda activate deepke
|
||||||
|
|
||||||
|
Install by pypi
|
||||||
|
---------------
|
||||||
|
|
||||||
|
If use deepke directly
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
pip install deepke
|
||||||
|
|
||||||
|
|
||||||
|
Install by setup.py
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
If modify source codes before usage
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
python setup.py install
|
|
@ -0,0 +1,107 @@
|
||||||
|
Start
|
||||||
|
=====
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Model Framework
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. image:: ./_static/architectures.png
|
||||||
|
|
||||||
|
DeepKE contains three modules for named entity recognition, relation extraction and attribute extraction, the three tasks respectively.
|
||||||
|
|
||||||
|
Each module has its own submodules. For example, there are standard, document-level and few-shot submodules in the attribute extraction modular.
|
||||||
|
|
||||||
|
Each submodule compose of three parts: a collection of tools, which can function as tokenizer, dataloader, preprocessor and the like, a encoder and a part for training and prediction
|
||||||
|
|
||||||
|
Dataset
|
||||||
|
-------
|
||||||
|
|
||||||
|
We use the following datasets in our experiments:
|
||||||
|
|
||||||
|
+--------------------------+-----------+------------------+----------+------------+
|
||||||
|
| Task | Settings | Corpus | Language | Model |
|
||||||
|
+==========================+===========+==================+==========+============+
|
||||||
|
| | | CoNLL-2003 | English | |
|
||||||
|
| | Standard +------------------+----------+ BERT |
|
||||||
|
| | | People's Daily | Chinese | |
|
||||||
|
| +-----------+------------------+----------+------------+
|
||||||
|
| | | CoNLL-2003 | | |
|
||||||
|
| | +------------------+ | |
|
||||||
|
| Name Entity Recognition | | MIT Movie | | |
|
||||||
|
| | Few-shot +------------------+ English | LightNER |
|
||||||
|
| | | MIT Restaurant | | |
|
||||||
|
| | +------------------+ | |
|
||||||
|
| | | ATIS | | |
|
||||||
|
+--------------------------+-----------+------------------+----------+------------+
|
||||||
|
| | | | | CNN |
|
||||||
|
| | | | +------------+
|
||||||
|
| | | | | RNN |
|
||||||
|
| | | | +------------+
|
||||||
|
| | | | | Capsule |
|
||||||
|
| | Standard | DuIE | Chinese +------------+
|
||||||
|
| | | | | GCN |
|
||||||
|
| | | | +------------+
|
||||||
|
| | | | | Transformer|
|
||||||
|
| | | | +------------+
|
||||||
|
| | | | | BERT |
|
||||||
|
| +-----------+------------------+----------+------------+
|
||||||
|
| Relation Extraction | | SEMEVAL(8-shot) | | |
|
||||||
|
| | +------------------+ | |
|
||||||
|
| | | SEMEVAL(16-shot) | | |
|
||||||
|
| | Few-shot +------------------+ English | KnowPrompt |
|
||||||
|
| | | SEMEVAL(32-shot) | | |
|
||||||
|
| | +------------------+ | |
|
||||||
|
| | | SEMEVAL(Full) | | |
|
||||||
|
| +-----------+------------------+----------+------------+
|
||||||
|
| | | DocRED | | |
|
||||||
|
| | +------------------+ | |
|
||||||
|
| | Document | CDR | English | DocuNet |
|
||||||
|
| | +------------------+ | |
|
||||||
|
| | | GDA | | |
|
||||||
|
+--------------------------+-----------+------------------+----------+------------+
|
||||||
|
| | | | | CNN |
|
||||||
|
| | | | +------------+
|
||||||
|
| | | | | RNN |
|
||||||
|
| | | | +------------+
|
||||||
|
| | |Triplet Extraction| | Capsule |
|
||||||
|
| Attribute Extraction | Standard |Dataset | Chinese +------------+
|
||||||
|
| | | | | GCN |
|
||||||
|
| | | | +------------+
|
||||||
|
| | | | | Transformer|
|
||||||
|
| | | | +------------+
|
||||||
|
| | | | | BERT |
|
||||||
|
+--------------------------+-----------+------------------+----------+------------+
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Get Start
|
||||||
|
---------
|
||||||
|
|
||||||
|
If you want to use our code , you can do as follow:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
git clone https://github.com/zjunlp/DeepKE.git
|
||||||
|
cd DeepKE
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue