Skip to content

Commit dd18590

Browse files
committed
Improve visualization of constituency tree
1 parent cb6ee6c commit dd18590

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

plugins/hanlp_common/hanlp_common/document.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,8 @@ def condense(block_, extras_=None):
316316
while ' ─' in row[1]:
317317
row[1] = row[1].replace(' ─', ' ──')
318318
row[1] = row[1].replace('─ ─', '───')
319-
row[1] = row[1].replace('─ │', '───┤')
320-
row[1] = row[1].replace('─ ├', '───┼')
321-
row[1] = re.sub(r'►([\w-]+)(\s+)([│├])', lambda
322-
m: f'►{m.group(1)}{"─" * len(m.group(2))}{"┤" if m.group(3) == "│" else "┼"}', row[1])
319+
row[1] = re.sub(r'([►─])([\w-]*)(\s+)([│├])', lambda
320+
m: f'{m.group(1)}{m.group(2)}{"─" * len(m.group(3))}{"┤" if m.group(4) == "│" else "┼"}', row[1])
323321
row[1] = re.sub(r'►(─+)►', r'─\1►', row[1])
324322
for r, s in zip(extras, text):
325323
r.extend(s)

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.14',
13+
version='0.0.15',
1414
description='HanLP: Han Language Processing',
1515
long_description=long_description,
1616
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)