Skip to content

Commit

Permalink
Merge branch 'hotfix/1.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
emfomy committed Nov 3, 2020
2 parents d62c516 + 24b3868 commit 1213330
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 24 deletions.
16 changes: 10 additions & 6 deletions DEVELOP.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Release TODO
- change version number
- make clean
- make lint
- make doc
- make tox
- make tox-report
- make upload

- >> make clean
- >> make lint
- >> make doc
- >> make tox
- >> make tox-report
- merge to master branch
- >> make clean
- >> make upload
2 changes: 1 addition & 1 deletion ckip_classic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__copyright__ = '2018-2020 CKIP Lab'

__title__ = 'CkipClassic'
__version__ = '1.1.1'
__version__ = '1.1.2'
__description__ = 'CKIP Classic NLP Tools'
__license__ = 'CC BY-NC-SA 4.0'

Expand Down
18 changes: 15 additions & 3 deletions ckip_classic/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
__copyright__ = '2018-2020 CKIP Lab'
__license__ = 'CC BY-NC-SA 4.0'

import os as _os
import warnings as _warnings

from ._parser import CkipParserSocket

################################################################################################################################
Expand All @@ -15,17 +18,26 @@ class CkipParserClient:
Parameters
----------
username : str
the username.
the username (default to the environment variable `$CKIPPARSER_USERNAME`).
password : str
the password.
the password (default to the environment variable `$CKIPPARSER_PASSWORD`).
Note
----
One may register an account at http://parser.iis.sinica.edu.tw/v1/reg.exe
"""

def __init__(self, *, username, password):
def __init__(self, *,
username=_os.getenv('CKIPPARSER_USERNAME'),
password=_os.getenv('CKIPPARSER_PASSWORD'),
):

if username is None:
_warnings.warn('Invalid username (%s)' % username)
if password is None:
_warnings.warn('Invalid password (%s)' % password)

self.socket = CkipParserSocket(username=username, password=password)

def __call__(self, text):
Expand Down
3 changes: 1 addition & 2 deletions ckip_classic/ini.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

import ckip_classic as _about

def create_ws_lex(*lex_list
):
def create_ws_lex(*lex_list):
"""Generate CKIP word segmentation lexicon file.
Parameters
Expand Down
4 changes: 2 additions & 2 deletions test/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CLIENT_USERNAME=
CLIENT_PASSWORD=
CKIPPARSER_USERNAME=
CKIPPARSER_PASSWORD=
1 change: 0 additions & 1 deletion test/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
..
python-dotenv
10 changes: 1 addition & 9 deletions test/script/test_parser_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,11 @@

import os

from dotenv import load_dotenv

from ckip_classic.client import CkipParserClient

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

load_dotenv()
USERNAME = os.getenv('CLIENT_USERNAME')
PASSWORD = os.getenv('CLIENT_PASSWORD')

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

parser = CkipParserClient(username=USERNAME, password=PASSWORD, )
parser = CkipParserClient()

text_in = [
'中文字(Na) 耶(T) ,(COMMACATEGORY)',
Expand Down
2 changes: 2 additions & 0 deletions test/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ commands =
[testenv:py36-client]
deps =
{[testenv]deps}
python-dotenv[cli]
-rrequirements.txt

commands =
dotenv -f {toxinidir}/.env run \
pytest \
{toxinidir}/script/test_parser_client.py \
{env:NO_COV:--cov=ckip_classic.client} \
Expand Down

0 comments on commit 1213330

Please sign in to comment.