From 25259b4b558a4791ee15255ddba6b5482e357ef6 Mon Sep 17 00:00:00 2001 From: Le Tuan Anh Date: Thu, 13 May 2021 23:35:08 +0800 Subject: [PATCH] Initial documentation --- docs/Makefile | 20 ++++++++ docs/conf.py | 52 ++++++++++++++++++++ docs/index.rst | 111 ++++++++++++++++++++++++++++++++++++++++++ docs/make.bat | 35 +++++++++++++ docs/requirements.txt | 1 + 5 files changed, 219 insertions(+) create mode 100644 docs/Makefile create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/make.bat create mode 100644 docs/requirements.txt diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/docs/Makefile @@ -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 = . +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) diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..38bbf24 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,52 @@ +# 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('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'coolisf' +copyright = '2021, Le Tuan Anh ' +author = 'Le Tuan Anh ' + + +# -- 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 = [ +] + +# 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 = ['_build', 'Thumbs.db', '.DS_Store'] + + +# -- 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 = 'alabaster' + +# 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'] \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..d892137 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,111 @@ +.. coolisf documentation master file, created by + sphinx-quickstart on Thu May 13 23:03:13 2021. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to coolisf's documentation! +=================================== + +``coolisf`` is a Python 3 implementation of the `Integrated Semantic +Framework `__ that provides computational deep +semantic analysis by combining structural semantics from construction +grammars and lexical semantics from ontologies in a single +representation. + +Install +======= + +``coolisf`` only works on Linux distributions at the moment (built and +tested on Fedora and Ubuntu Linux). + +- Install ``coolisf`` package from + `PyPI `__ using pip + +:: + + pip install coolisf + +- Create coolisf data folder at ``/home/user/local/isf/data`` +- Download ace-0.9.26 binary from https://osf.io/x52fy/ to + ``/home/user/bin/ace``. Make sure that you can run ace by + +.. code:: bash + + [isf]$ ~/bin/ace -V + ACE version 0.9.26 + compiled at 18:48:50 on Sep 14 2017 + +- Install `lelesk `__ and yawlib with + data +- Download coolisf lexical rules database from https://osf.io/qn4wz/ + and extract it to ``/home/user/local/isf/data/lexrules.db`` +- Download grammar files (erg.dat, jacy.dat, virgo.dat, etc.) and copy + them to ``/home/user/local/isf/data/grammars/`` + +The final data folder should look something like this + +:: + + /home/user/local/isf/data + ├── grammars + │   ├── erg.dat + │   └── jacy.dat + ├── lexrules.db + +Using ISF +========= + +To parse a sentence, use coolisf ``text`` command + +.. code:: bash + + python -m coolisf text "I drink green tea." -f dmrs + + :`I drink green tea.` (len=5) + ------------------------------------------------------------ + dmrs { + 10000 [pron<0:1> x ind=+ num=sg pers=1 pt=std]; + 10001 [pronoun_q<0:1> x ind=+ num=sg pers=1 pt=std]; + 10002 [_drink_v_1_rel<2:7> e mood=indicative perf=- prog=- sf=prop tense=pres]; + 10003 [udef_q<8:18> x num=sg pers=3]; + 10004 [_green+tea_n_1_rel<8:18> x num=sg pers=3]; + 0:/H -> 10002; + 10001:RSTR/H -> 10000; + 10002:ARG1/NEQ -> 10000; + 10002:ARG2/NEQ -> 10004; + 10003:RSTR/H -> 10004; + } + # 10002 -> 01170052-v[drink/lelesk] + # 10004 -> 07935152-n[green tea/lelesk] + ... + +For batch processing, create a text file with each sentence on a +separate line. For example here is the content of the file +``sample.txt`` + +:: + + I drink green tea. + Sherlock Holmes has three guard dogs. + A soul is not a living thing. + Do you have any green tea chest? + +After that, run the following command and the output will be written to +the file ``demo_out.xml`` + +.. code:: bash + + python -m coolisf parse demo.txt -o demo_out.xml + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..2119f51 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +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.http://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 diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..2806c16 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1 @@ +Sphinx