Skip to content

Commit

Permalink
Merge pull request #26 from letuananh/dev
Browse files Browse the repository at this point in the history
yawlib 0.1 stable release
  • Loading branch information
letuananh authored May 13, 2021
2 parents ab31858 + 9af9821 commit 01cac5e
Show file tree
Hide file tree
Showing 22 changed files with 190 additions and 627 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
YAWlib - Yet Another WordNet library for Python
===============
# YAWlib - Yet Another WordNet library for Python

A Python library for accessing major WordNet releases using relational databases for high performance batch processing.

Supporting Wordnets:

- Princeton Wordnet 3.0
- NTU Open Multilingual WordNet
- Gloss WordNet
- and more to be added in future versions

# Installation
## Installation

Yawlib is available on [PyPI](https://pypi.org/project/yawlib/)

```bash
pip install yawlib
```

Download prebuilt database files are available on the author's [Open Science Framework project page: https://osf.io/9udjk/](https://osf.io/9udjk/) and extract them to your home folder at `~/wordnet/`.
On Linux it should look something like
Prebuilt database files are available on the author's [Open Science Framework project page: https://osf.io/9udjk/](https://osf.io/9udjk/).
Download them and extract those to your home folder at `~/wordnet/`.
On Linux it should look something like:

```
/home/username/wordnet/
Expand Down Expand Up @@ -49,7 +48,7 @@ To verify that yawlib is working properly, you can use the `info` command.
python3 -m yawlib info
```

# Command-line tools
## Command-line tools

`yawlib` includes a command-line tool for querying wordnets directly from terminal.

Expand Down Expand Up @@ -87,10 +86,11 @@ Looking for synsets by term (Provided: research | pos = None)
Found 4 synset(s)
```

# Development
## Development

Go to yawlib folder, execute the config script and then run wntk.sh to generate the glosstab DB file.
```

```bash
git clone https://github.com/letuananh/yawlib
cd yawlib

Expand Down Expand Up @@ -147,7 +147,7 @@ The run the `create` command to generate the database
python -m yawlib create
```

# Original sources
## Original sources

- WordNet 3.0 SQLite: https://sourceforge.net/projects/wnsql/files/wnsql3/sqlite/3.0/
- WordNet glosstag (XML): http://wordnet.princeton.edu/glosstag.shtml
Expand Down
3 changes: 0 additions & 3 deletions requirements-dev.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements-optional.txt

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
texttaglib>=0.1.1a4
texttaglib>=0.1.1, <0.2
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def read(*filenames, **kwargs):

with open('requirements.txt', 'r') as infile:
requirements = infile.read().splitlines()
print(requirements)


setup(
Expand Down Expand Up @@ -89,7 +88,7 @@ def read(*filenames, **kwargs):
test_suite='test',
# Reference: https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=['Programming Language :: Python',
'Development Status :: 2 - Pre-Alpha',
'Development Status :: {}'.format(pkg_info['__status__']),
'Natural Language :: English',
'Environment :: Plugins',
'Intended Audience :: Developers',
Expand Down
11 changes: 5 additions & 6 deletions yawlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
# -*- coding: utf-8 -*-

'''
YAWLib - Yet another WordNet library for Python
Latest version can be found at https://github.com/letuananh/yawlib
:copyright: (c) 2012 Le Tuan Anh <tuananh.ke@gmail.com>
:license: MIT, see LICENSE for more details.
Python library for accessing major wordnet releases using relational databases for high performance batch processing
'''

# This code is a part of yawlib library: https://github.com/letuananh/yawlib
# :copyright: (c) 2014 Le Tuan Anh <tuananh.ke@gmail.com>
# :license: MIT, see LICENSE for more details.

from . import __version__ as version_info
from .__version__ import __author__, __email__, __copyright__, __maintainer__
from .__version__ import __credits__, __license__, __description__, __url__
Expand Down
4 changes: 4 additions & 0 deletions yawlib/__main__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# This code is a part of yawlib library: https://github.com/letuananh/yawlib
# :copyright: (c) 2014 Le Tuan Anh <tuananh.ke@gmail.com>
# :license: MIT, see LICENSE for more details.

from . import wntk
wntk.main()
12 changes: 8 additions & 4 deletions yawlib/__version__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# -*- coding: utf-8 -*-

# This code is a part of yawlib library: https://github.com/letuananh/yawlib
# :copyright: (c) 2014 Le Tuan Anh <tuananh.ke@gmail.com>
# :license: MIT, see LICENSE for more details.

# yawlib's package version information
__author__ = "Le Tuan Anh"
__email__ = "tuananh.ke@gmail.com"
__copyright__ = "Copyright (c) 2014, Le Tuan Anh"
__credits__ = []
__license__ = "MIT License"
__description__ = "YAWLib - Yet another WordNet library for Python"
__description__ = "Python library for accessing major wordnet releases using relational databases for high performance batch processing"
__url__ = "https://github.com/letuananh/yawlib"
__maintainer__ = "Le Tuan Anh"
__version_major__ = "0.1"
__version__ = "{}a3".format(__version_major__)
__version_long__ = "{} - Alpha 3".format(__version_major__)
__status__ = "3 - Alpha"
__version__ = "{}".format(__version_major__)
__version_long__ = "{} Stable".format(__version_major__)
__status__ = "5 - Production/Stable"
58 changes: 6 additions & 52 deletions yawlib/common.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,17 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'''
"""
Shared Wordnet features
Latest version can be found at https://github.com/letuananh/yawlib
"""

References:
Python documentation:
https://docs.python.org/
PEP 0008 - Style Guide for Python Code
https://www.python.org/dev/peps/pep-0008/
PEP 257 - Python Docstring Conventions:
https://www.python.org/dev/peps/pep-0257/
# This code is a part of yawlib library: https://github.com/letuananh/yawlib
# :copyright: (c) 2014 Le Tuan Anh <tuananh.ke@gmail.com>
# :license: MIT, see LICENSE for more details.

@author: Le Tuan Anh <tuananh.ke@gmail.com>
'''

# Copyright (c) 2017, Le Tuan Anh <tuananh.ke@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

__author__ = "Le Tuan Anh"
__email__ = "<tuananh.ke@gmail.com>"
__copyright__ = "Copyright 2017, yawlib"
__license__ = "MIT"
__maintainer__ = "Le Tuan Anh"
__version__ = "0.1"
__status__ = "Prototype"
__credits__ = []

########################################################################

# -------------------------------------------------------------------------------
# Configuration
# -------------------------------------------------------------------------------


# -------------------------------------------------------------------------------
# Exceptions
# -------------------------------------------------------------------------------

class WordnetException(Exception):
''' Base class for Wordnet exception '''
""" Base class for Wordnet exception """
pass


Expand Down
48 changes: 9 additions & 39 deletions yawlib/config.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,13 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'''
"""
Global configuration file for YAWLib
Latest version can be found at https://github.com/letuananh/yawlib
Adapted from: https://github.com/letuananh/lelesk
@author: Le Tuan Anh <tuananh.ke@gmail.com>
'''

# Copyright (c) 2016, Le Tuan Anh <tuananh.ke@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

__author__ = "Le Tuan Anh <tuananh.ke@gmail.com>"
__copyright__ = "Copyright 2017, yawlib"
__credits__ = []
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "Le Tuan Anh"
__email__ = "<tuananh.ke@gmail.com>"
__status__ = "Prototype"
"""

# This code is a part of yawlib library: https://github.com/letuananh/yawlib
# :copyright: (c) 2014 Le Tuan Anh <tuananh.ke@gmail.com>
# :license: MIT, see LICENSE for more details.

import os
import logging
Expand All @@ -61,9 +31,9 @@ def getLogger():


def _get_config_manager():
''' Internal function for retrieving application config manager object
""" Internal function for retrieving application config manager object
Don't use this directly, use read_config() method instead
'''
"""
return __app_config


Expand All @@ -90,7 +60,7 @@ def home_dir():


def config_file_path():
''' get config location '''
""" get config location """
return _get_config_manager().locate_config()


Expand Down
42 changes: 6 additions & 36 deletions yawlib/glosswordnet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-

'''
Gloss WordNet XML Data Access Object - Access Gloss WordNet in either
XML or SQLite format
Latest version can be found at https://github.com/letuananh/lelesk
"""
Gloss WordNet XML Data Access Object - Access Gloss WordNet in either XML or SQLite format
Usage:
Expand All @@ -15,43 +13,15 @@
or
from glosswordnet import SQLiteGWordNet
[TODO] WIP
"""

@author: Le Tuan Anh <tuananh.ke@gmail.com>
'''
# This code is a part of yawlib library: https://github.com/letuananh/yawlib
# :copyright: (c) 2014 Le Tuan Anh <tuananh.ke@gmail.com>
# :license: MIT, see LICENSE for more details.

# Copyright (c) 2014, Le Tuan Anh <tuananh.ke@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

__author__ = "Le Tuan Anh <tuananh.ke@gmail.com>"
__copyright__ = "Copyright 2014, lelesk"
__credits__ = []
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "Le Tuan Anh"
__email__ = "<tuananh.ke@gmail.com>"
__status__ = "Prototype"
from .gwnmodels import GlossedSynset, GlossRaw, Gloss, GlossItem, GlossGroup, SenseTag
from .gwnxml import GWordnetXML
from .gwnsqlite import GWordnetSQLite


__all__ = ['GlossedSynset', 'GWordnetXML', 'GWordnetSQLite',
'GlossRaw', 'Gloss', 'GlossItem', 'GlossGroup', 'SenseTag']
Loading

0 comments on commit 01cac5e

Please sign in to comment.