Skip to content

Commit 37f5f6e

Browse files
committed
Merge pull request yzhangcs#1 from yzhangcs/main
Catch up 3 commits
2 parents 9346c71 + c2619f1 commit 37f5f6e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

supar/utils/field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def __repr__(self):
104104
return s
105105

106106
def __getstate__(self):
107-
state = self.__dict__
107+
state = dict(self.__dict__)
108108
if self.tokenize is None:
109109
state['tokenize_args'] = None
110110
elif self.tokenize.__module__.startswith('transformers'):

supar/utils/transform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,12 +501,12 @@ def totree(cls, tokens, root=''):
501501
502502
Examples:
503503
>>> print(Tree.totree(['She', 'enjoys', 'playing', 'tennis', '.'], 'TOP'))
504-
(TOP (_ She) (_ enjoys) (_ playing) (_ tennis) (_ .))
504+
(TOP ( (_ She)) ( (_ enjoys)) ( (_ playing)) ( (_ tennis)) ( (_ .)))
505505
"""
506506

507507
if isinstance(tokens[0], str):
508508
tokens = [(token, '_') for token in tokens]
509-
tree = ' '.join([f"({pos} {word})" for word, pos in tokens])
509+
tree = ' '.join([f"( ({pos} {word}))" for word, pos in tokens])
510510
return nltk.Tree.fromstring(f"({root} {tree})")
511511

512512
@classmethod

0 commit comments

Comments
 (0)