Skip to content

Commit 4467a3c

Browse files
committed
Optimize merging sub-tokens
1 parent e843a4e commit 4467a3c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

hanlp/components/tokenizers/transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ def spans_to_tokens(self, spans, batch, rebuild_span=False):
181181
combined = text[offsets[spans_per_sent[start - delta][0]][0]:
182182
offsets[spans_per_sent[end - delta - 1][1] - 1][1]]
183183
else:
184-
combined = tokens[start:end]
185-
buffer.append(''.join(combined))
184+
combined = ''.join(tokens[start:end])
185+
buffer.append(combined)
186186
offset = end
187187
if rebuild_span:
188188
start -= delta

hanlp/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Author: hankcs
33
# Date: 2019-12-28 19:26
44

5-
__version__ = '2.1.0-beta.18'
5+
__version__ = '2.1.0-beta.19'
66
"""HanLP version"""
77

88

0 commit comments

Comments
 (0)