Skip to content

Commit

Permalink
Merge pull request #22 from letuananh/dev
Browse files Browse the repository at this point in the history
First release to PyPI
  • Loading branch information
letuananh authored Apr 18, 2018
2 parents b255b11 + 94eb3e9 commit e1fcefd
Show file tree
Hide file tree
Showing 25 changed files with 277 additions and 127 deletions.
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include README.md
include CHANGES.md
recursive-include yawlib/data *.json
recursive-include yawlib/glosswordnet/script *.sql
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,53 @@ WordNet glosstag : https://drive.google.com/open?id=0Bwko6IfQbRUJVUlkNEs

# Installation

Extract the glosstag folder and sqlite-30.db to ~/wordnet. The directory should look like this:
Yawlib is available on PyPI
```bash
pip install yawlib
# or
python3 -m pip install yawlib

# Download wordnet data and extract them to ~/wordnet

# Show yawlib information
python3 -m yawlib info
```

Search synsets by the lemma `research`, use `python3 -m yawlib lemma research`

```
wn lemma research
Looking for synsets by term (Provided: research | pos = None)
〔Synset〕00636921-n 〔Lemmas〕research 〔Keys〕research%1:04:00::
------------------------------------------------------------
(def) “systematic investigation to establish facts;”
〔Synset〕05797597-n 〔Lemmas〕inquiry; enquiry; research 〔Keys〕inquiry%1:09:01:: enquiry%1:09:00:: research%1:09:00::
------------------------------------------------------------
(def) “a search for knowledge;”
(ex) their pottery deserves more research than it has received;
〔Synset〕00648224-v 〔Lemmas〕research; search; explore 〔Keys〕research%2:31:00:: search%2:31:00:: explore%2:31:00::
------------------------------------------------------------
(def) “inquire into;”
(ex) the students had to research the history of the Second World War for their history project;
(ex) He searched for information on his relatives on the web;
(ex) Scientists are exploring the nature of consciousness;
〔Synset〕00877327-v 〔Lemmas〕research 〔Keys〕research%2:32:00::
------------------------------------------------------------
(def) “attempt to find out in a systematically and scientific manner;”
(ex) The student researched the history of that word;
Found 4 synset(s)
```

Note: Extract the glosstag folder and sqlite-30.db to ~/wordnet. The directory should look like this:

```
/home/user/wordnet
├── glosstag
Expand Down Expand Up @@ -47,6 +93,9 @@ Extract the glosstag folder and sqlite-30.db to ~/wordnet. The directory should
├── sqlite-30.db
```

# Development

Go to yawlib folder, execute the config script and then run wntk.sh to generate the glosstab DB file.
```
cd ~/workspace
Expand Down
4 changes: 4 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

pandoc --from=markdown --to=rst README.md -o README.rst
python3 setup.py sdist
1 change: 1 addition & 0 deletions requirements-optional.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flask
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
chirptext >= 0.1a5
lxml
fuzzywuzzy
python-levenshtein
lxml
flask

chirptext>=0.1a16
puchikarui>=0.1a1
6 changes: 4 additions & 2 deletions run
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash

export FLASK_APP=yawol-flask.py
flask run
# export FLASK_APP=yawol-flask.py
# flask run
export FLASK_DEBUG=1
python3 -m yawlib.yawol.app
97 changes: 42 additions & 55 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,11 @@

'''
Setup script for YAWLib.
Latest version can be found at https://github.com/letuananh/yawlib
Adapted from: https://github.com/letuananh/lelesk
References:
Python documentation:
https://docs.python.org/
argparse module:
https://docs.python.org/3/howto/argparse.html
PEP 257 - Python Docstring Conventions:
https://www.python.org/dev/peps/pep-0257/
Latest version can be found at https://github.com/letuananh/yawlib
@author: Le Tuan Anh <tuananh.ke@gmail.com>
:copyright: (c) 2015 Le Tuan Anh <tuananh.ke@gmail.com>
:license: MIT, see LICENSE for more details.
'''

# Copyright (c) 2015, Le Tuan Anh <tuananh.ke@gmail.com>
Expand All @@ -38,33 +30,15 @@
# 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 2015, yawlib"
__credits__ = []
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "Le Tuan Anh"
__email__ = "<tuananh.ke@gmail.com>"
__status__ = "Prototype"

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

from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import io
import codecs
import os
import sys

from uberapp import uberapp

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


here = os.path.abspath(os.path.dirname(__file__))
from setuptools import setup


def read(*filenames, **kwargs):
''' Read contents of multiple files and join them together '''
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
Expand All @@ -74,35 +48,48 @@ def read(*filenames, **kwargs):
return sep.join(buf)


long_description = read('README.md', 'CHANGES.md')
readme_file = 'README.rst' if os.path.isfile('README.rst') else 'README.md'
long_description = read(readme_file)
pkg_info = {}
exec(read('yawlib/__version__.py'), pkg_info)


setup(
name='uberapp',
version=uberapp.__version__,
url='https://github.com/letuananh/pydemo',
license='MIT License',
author='Le Tuan Anh',
tests_require=[],
install_requires=[],
author_email='tuananh.ke@gmail.com',
description='An uber software which does not do anything useful',
name='yawlib', # package file name (<package-name>-version.tar.gz)
version=pkg_info['__version__'],
url=pkg_info['__url__'],
project_urls={
"Bug Tracker": "https://github.com/letuananh/yawlib/issues",
"Source Code": "https://github.com/letuananh/yawlib/"
},
keywords="princeton wordnet glosstag omw",
license=pkg_info['__license__'],
author=pkg_info['__author__'],
tests_require=['lxml', 'fuzzywuzzy', 'python-levenshtein', 'chirptext>=0.1a16', 'puchikarui'],
install_requires=['lxml', 'fuzzywuzzy', 'python-levenshtein', 'chirptext>=0.1a16', 'puchikarui'],
author_email=pkg_info['__email__'],
description=pkg_info['__description__'],
long_description=long_description,
packages=['uberapp'],
packages=['yawlib',
'yawlib.glosswordnet',
'yawlib.yawol',
'yawlib.yawol.django',
'yawlib.yawol.django.migrations'],
package_data={'yawlib': ['data/*.json',
'glosswordnet/script/*.sql']},
include_package_data=True,
platforms='any',
test_suite='test',
classifiers = [
'Programming Language :: Python',
'Development Status :: 0.1 - Alpha',
'Natural Language :: English',
'Environment :: Console Application',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Topic :: Software Development :: Libraries :: Python Modules',
]#,
#extras_require={
# 'testing': ['pytest'],
#}
# Reference: https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=['Programming Language :: Python',
'Development Status :: 2 - Pre-Alpha',
'Natural Language :: English',
'Environment :: Plugins',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: {}'.format(pkg_info['__license__']),
'Operating System :: OS Independent',
'Topic :: Text Processing',
'Topic :: Text Processing :: Linguistic',
'Topic :: Software Development :: Libraries :: Python Modules']
)
2 changes: 1 addition & 1 deletion wntk
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if [ -z "$YAWLIB_HOME" ]; then
fi
cd ${YAWLIB_HOME}
# setup alias
python3 -m yawlib.wntk "$@"
python3 -m yawlib "$@"
22 changes: 22 additions & 0 deletions yawlib-api.org
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,28 @@ These functions should return a list of synset objects
- hyponyms(synsetid, deep_select=True)
- hypehypo(synsetid, deep_select=True)

* REST APIs
** Flask
To run Yawol Flask, use
```bash
# to debug, use
# export FLASK_DEBUG=1
python3 -m yawlib.yawol.app
```
*** Testing API
To ensure that Yawol is running, visit this URL: http://localhost:5000/yawol/version
(Change the port 5000 to your actual port)

** Django
To run Yawol Django, use
```bash
python3 manage.py runserver
```

*** Testing API
To ensure that Yawol is running, visit this URL: http://localhost:8000/yawol/version
(Change the port 8000 to your actual port)

* Support datasets
** WordnetSQL
** GlossedWordnet
Expand Down
40 changes: 8 additions & 32 deletions yawlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,16 @@

'''
YAWLib - Yet another WordNet library for Python
Latest version can be found at https://github.com/letuananh/yawlib
Adapted from: https://github.com/letuananh/lelesk
Latest version can be found at https://github.com/letuananh/yawlib
@author: Le Tuan Anh <tuananh.ke@gmail.com>
:copyright: (c) 2012 Le Tuan Anh <tuananh.ke@gmail.com>
:license: MIT, see LICENSE for more details.
'''

# 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 2014, yawlib"
__credits__ = []
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "Le Tuan Anh"
__email__ = "<tuananh.ke@gmail.com>"
__status__ = "Prototype"
from .__version__ import __author__, __email__, __copyright__, __maintainer__
from .__version__ import __credits__, __license__, __description__, __url__
from .__version__ import __version_major__, __version_long__, __version__, __status__

from .config import YLConfig
from .models import SynsetID, POS, Synset, SynsetCollection
Expand All @@ -51,4 +26,5 @@
'POS', 'SynsetID', 'Synset', 'SynsetCollection',
'get_synset_by_id', 'get_synset_by_sk',
'get_synsets_by_term', 'dump_synsets', 'dump_synset',
'WordnetException', 'SynsetNotFoundException']
'WordnetException', 'SynsetNotFoundException',
"__version__", "__author__", "__description__", "__copyright__"]
2 changes: 2 additions & 0 deletions yawlib/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import wntk
wntk.main()
15 changes: 15 additions & 0 deletions yawlib/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-

# 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"
__url__ = "https://github.com/letuananh/yawlib"
__maintainer__ = "Le Tuan Anh"
__version_major__ = "0.1"
__version__ = "{}a1".format(__version_major__)
__version_long__ = "{} - Alpha".format(__version_major__)
__status__ = "Prototype"
Loading

0 comments on commit e1fcefd

Please sign in to comment.