Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
emfomy committed Apr 2, 2019
2 parents df5cab6 + 92f71b2 commit fe2de9c
Show file tree
Hide file tree
Showing 14 changed files with 961 additions and 2 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018-2019 Mu Yang

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.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include about.pyx
include ckipws/*.*
include ckipparser/*.*
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CC = gcc
PY = python
RM = rm -rf

.PHONY: all build build_ext dist bdist bdist_wheel sdist upload clean run

all: build

dist: sdist

build: build_ext

bdist: bdist_wheel

build_ext bdist_wheel sdist:
$(PY) setup.py $@

upload: dist
twine upload --repository-url https://test.pypi.org/legacy/ dist/*.tar.gz --verbose

clean:
$(PY) setup.py clean -a
$(RM) build dist pyckip.egg-info
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

119 changes: 119 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
PyCkip
========

CKIP NLP Wrappers (Word Segmentation and Parser)

Introduction
------------

Git
^^^

https://github.com/emfomy/pyckip

|Github Release| |Github License| |Github Forks| |Github Stars| |Github Watchers|

.. |Github Release| image:: https://img.shields.io/github/release/emfomy/pyckip/all.svg?maxAge=3600
:target: https://github.com/emfomy/pyckip/releases

.. |Github License| image:: https://img.shields.io/github/license/emfomy/pyckip.svg?maxAge=3600

.. |Github Downloads| image:: https://img.shields.io/github/downloads/emfomy/pyckip/total.svg?maxAge=3600
:target: https://github.com/emfomy/pyckip/releases/latest

.. |Github Forks| image:: https://img.shields.io/github/forks/emfomy/pyckip.svg?style=social&label=Fork&maxAge=3600

.. |Github Stars| image:: https://img.shields.io/github/stars/emfomy/pyckip.svg?style=social&label=Star&maxAge=3600

.. |Github Watchers| image:: https://img.shields.io/github/watchers/emfomy/pyckip.svg?style=social&label=Watch&maxAge=3600

PyPI
^^^^

https://pypi.org/project/pyckip

|Pypi Version| |Pypi License| |Pypi Format| |Pypi Python| |Pypi Implementation| |Pypi Status|

.. |Pypi Version| image:: https://img.shields.io/pypi/v/pyckip.svg?maxAge=3600
:target: https://pypi.org/project/pyckip

.. |Pypi License| image:: https://img.shields.io/pypi/l/pyckip.svg?maxAge=3600

.. |Pypi Format| image:: https://img.shields.io/pypi/format/pyckip.svg?maxAge=3600

.. |Pypi Python| image:: https://img.shields.io/pypi/pyversions/pyckip.svg?maxAge=3600

.. |Pypi Implementation| image:: https://img.shields.io/pypi/implementation/pyckip.svg?maxAge=3600

.. |Pypi Status| image:: https://img.shields.io/pypi/status/pyckip.svg?maxAge=3600

Author
^^^^^^

* Mu Yang <[email protected]>

Requirements
^^^^^^^^^^^^

* `Python <http://www.python.org>`_ 2.7+, 3.5+
* `Cython <http://cython.org>`_ 0.29+
* `Boost C++ Libraries <https://www.boost.org/>`_ 1.54.0
* CKIP Word Segmentation Linux version
* CKIP Parser Linux version

Installation
^^^^^^^^^^^^

Step 1: Setup CKIPWS environment
""""""""""""""""""""""""""""""""

Denote ``<ckipws-linux-root>`` as the root path of CKIPWS Linux Version. Add below command to ``~/.bashrc``

.. code-block:: bash
export LD_LIBRARY_PATH=<ckipws-linux-root>/lib:$LD_LIBRARY_PATH
export CKIPWS_DATA2=<ckipws-linux-root>/Data2
Step 2: Setup CKIP-Parser environment
"""""""""""""""""""""""""""""""""""""

Denote ``<ckipparser-linux-root>`` as the root path of CKIP-Parser Linux Version. Add below command to ``~/.bashrc``

.. code-block:: bash
export LD_LIBRARY_PATH=<ckipparser-linux-root>/lib:$LD_LIBRARY_PATH
export CKIPPARSER_RULE=<ckipparser-linux-root>/Rule
export CKIPPARSER_RDB=<ckipparser-linux-root>/RDB
Step 3: Install Using Pip
"""""""""""""""""""""""""

.. code-block:: bash
LIBRARY_PATH=<ckipws-linux-root>/lib:<ckipparser-linux-root>/lib:$LIBRARY_PATH pip install pyckip
FAQ
---

* I don't have CKIPWS/CKIP-Parser. What should I do?

Append :code:`--install-option='--no-ws'` or :code:`--install-option='--no-parser'` after the :code:`pip install` command to disable CKIPWS or CKIP-Parser.

.. code-block:: bash
# Disable CKIPWS support
pip install pyckip --install-option='--no-ws'
# Disable CKIP-Parser support
pip install pyckip --install-option='--no-parser'
* The CKIPWS throws "``what(): locale::facet::_S_create_c_locale name not valid``". What should I do?

.. code-block:: bash
apt-get install locales-all
License
-------

* `MIT License <LICENSE>`_
14 changes: 14 additions & 0 deletions about.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding:utf-8 -*-
# cython: language_level=3

__author_name__ = 'Mu Yang'
__author_email__ = '[email protected]'
__copyright__ = 'Copyright 2018-2019'

__title__ = 'pyckip'
__version__ = '0.3.0'
__description__ = 'CKIP NLP Wrappers'
__license__ = "MIT"

__url__ = 'https://github.com/emfomy/pyckip'
__download_url__ = __url__+'/tarball/'+__version__
Empty file added ckipparser/__init__.py
Empty file.
18 changes: 18 additions & 0 deletions ckipparser/cckipparser.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding:utf-8 -*-

__author__ = 'Mu Yang <[email protected]>'
__copyright__ = 'Copyright 2018-2019'

cdef extern:

ctypedef void* corenlp_t

corenlp_t CKIPCoreNLP_New()
int CKIPCoreNLP_InitData(corenlp_t obj, char *FileName);
int CKIPCoreNLP_ApplyFile(corenlp_t obj, char *input, char *output);
int CKIPCoreNLP_ApplyList(corenlp_t obj, int length, const Py_UNICODE **inputList);
int CKIPCoreNLP_Parse(corenlp_t obj, const Py_UNICODE* pwsText, Py_UNICODE** ppwsResult);
int CKIPCoreNLP_ParseFile(corenlp_t obj, char *input, char *output);
const Py_UNICODE* CKIPCoreNLP_GetResultBegin(corenlp_t obj);
const Py_UNICODE* CKIPCoreNLP_GetResultNext(corenlp_t obj);
void CKIPCoreNLP_Destroy(corenlp_t obj);
Loading

0 comments on commit fe2de9c

Please sign in to comment.