Skip to content

Commit 86d4651

Browse files
committed
Check edge cases that tok key is not presented in Document
1 parent 7b8d81e commit 86d4651

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

plugins/hanlp_common/hanlp_common/document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def to_conll(self, tok='tok', lem='lem', pos='pos', dep='dep', sdp='sdp') -> Uni
119119
dep = prefix_match(dep, self)
120120
sdp = prefix_match(sdp, self)
121121
results = CoNLLSentenceList()
122-
if not self[tok]:
122+
if not tok or not self[tok]:
123123
return results
124124
self = self._to_doc_without_spans(tok)
125125
flat = isinstance(self[tok][0], str)

plugins/hanlp_common/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name='hanlp_common',
13-
version='0.0.13',
13+
version='0.0.14',
1414
description='HanLP: Han Language Processing',
1515
long_description=long_description,
1616
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)