Giter Club home page Giter Club logo

gwadoc's Introduction

gwadoc

This package has two main uses:

  1. To provide user-facing documentation of things like relations and parts of speech used by wordnets.
  2. To provide a Python API for querying this documentation, such as for retrieving the localized name or definition for specific relations.

Installation

You can use pip to install gwadoc (use of a virtual environment is strongly recommended; see here). The minimum Python version is 3.5. As gwadoc is not on PyPI, you can give the GitHub URL to pip:

~$ pip install git+git://github.com/globalwordnet/gwadoc.git

... or clone the repository and install from your local copy:

~$ git clone https://github.com/globalwordnet/gwadoc.git
~$ cd gwadoc/
~/gwadoc$ pip install .

To mark gwadoc as a dependency for your project, just put the git+git://github.com/globalwordnet/gwadoc.git URL in your requirements.txt file or the appropriate place in your setup.py file.

To install the requirements for building the documentation, use the [build] extra. For example, when installing from a local copy:

~/gwadoc$ pip install .[build]

Usage

To use gwadoc in your Python code Then you can use it like this:

>>> import gwadoc
>>> for relname in gwadoc.RELATIONS[:5]:
...     print(relname, '\n   ', gwadoc.relations[relname].df.en)
... 
constitutive
    Core semantic relations that define synsets
hyponym
    a word that is more specific than a given word
hypernym
    a word that is more general than a given word
instance_hyponym
    an occurrence of something
instance_hypernym
    the type of an instance

Where gwadoc.RELATIONS is the inventory of relation names, and gwadoc.relations is the data structure containing documentation about each relation. For each relation, there are several fields:

Field Description Comments
df short definition Suitable for use in a mouseover
ex short example Suitable for use in a mouseover
dfn long definition
exe more examples
fa formal attributes
name relation name
proj project-specific names
test linguistic tests Probably language specific

For the formal attributes and project names that are available, see gwadoc.inventories. The data structure may be accessed (and defined) using dot-notation or index-notation:

>>> print(gwadoc.relations.hypernym.name)
Hypernym
>>> print(gwadoc.relations['hypernym']['name'])
Hypernym

String fields, such as df, ex, name, test, etc. use the gwadoc.base.MultiString class (see gwadoc.base) so that projects may provide these fields in their own language. The language may be requested directly, or the default language may be specified by calling the gwadoc.set_preferred_language() function:

>>> gwadoc.relations.hypernym.name
<MultiString (Hypernym)>
>>> gwadoc.relations.hypernym.name.ja
'上位語'
>>> gwadoc.set_preferred_language('ja')
>>> gwadoc.relations.hypernym.name
<MultiString (上位語)>

Building the Documentation

After installing the requirements, you can build the HTML documentation:

# main documentation
~/gwadoc$ python docs/build.py html > docs/index.html
# summary
~/gwadoc$ python docs/build.py --object summary html > docs/summary.html

Note: if you installed the requirements in a virtual environment make sure you activate it before building the documentation.

On github, the documentation is automatically made when there is a commit to the master branch and pushed to the gh-pages branch.

Contributing

Contributions are most welcome. Please see the contributing guide.

License

Creative Commons License
Global Wordnet Association Documentation by GWA Documentation Working Group is licensed under a Creative Commons Attribution 4.0 International License.

gwadoc's People

Contributors

fcbond avatar goodmami avatar gconnect avatar yoyo-go avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.