Skip to content

Commit

Permalink
Merge branch 'hotfix/1.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
emfomy committed Apr 24, 2021
2 parents 68a9862 + ece08e6 commit f58e6f5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
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.2.0'
__version__ = '1.2.1'
__description__ = 'CKIP Classic NLP Tools'
__license__ = 'GPL-3.0'

Expand Down
7 changes: 5 additions & 2 deletions ckip_classic/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def __init__(self, *,
):

if username is None:
_warnings.warn('Invalid username (%s)' % username)
raise RuntimeError('Username not specified.')
if password is None:
_warnings.warn('Invalid password (%s)' % password)
raise RuntimeError('Password not specified.')

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

Expand All @@ -59,6 +59,9 @@ def apply(self, text):
.. hint::
One may also call this method as :meth:`__call__`.
"""
res = self.socket(text)[0]
if res == 'Account Error':
raise RuntimeError('Invalid Username/Password')
return self.socket(text)[0]

def apply_list(self, ilist):
Expand Down
1 change: 0 additions & 1 deletion test/script/test_parser_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def test_apply():

def test_apply_list():
text_out = parser.apply_list(text_in)
print(text_out)
assert text_out == [
'#1:1.[0] S(Head:Nab:中文字|particle:Td:耶)#,(COMMACATEGORY)',
'#1:1.[0] %(particle:interjection(Head:I:啊)|time:Dh:哈|time:Dh:哈|time:Dh:哈)#。(PERIODCATEGORY)',
Expand Down

0 comments on commit f58e6f5

Please sign in to comment.