File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ def process_document(self, doc):
153
153
orig_bundle_id = bundle .bundle_id
154
154
bundle .bundle_id = orig_bundle_id + '-1'
155
155
for i , new_tree in enumerate (new_trees [1 :], 2 ):
156
- new_bundle = Bundle (document = doc , bundle_id = orig_bundle_id + '-' + str ( i ) )
156
+ new_bundle = Bundle (document = doc , bundle_id = f" { orig_bundle_id } - { i } " )
157
157
new_tree .zone = tree .zone
158
158
new_bundle .add_tree (new_tree )
159
159
new_bundles .append (new_bundle )
@@ -166,7 +166,7 @@ def process_document(self, doc):
166
166
bundle .bundle_id = orig_bundle_id + '-1'
167
167
tree .text = sentences [0 ]
168
168
for i , sentence in enumerate (sentences [1 :], 2 ):
169
- new_bundle = Bundle (document = doc , bundle_id = orig_bundle_id + '-' + str ( i ) )
169
+ new_bundle = Bundle (document = doc , bundle_id = f" { orig_bundle_id } - { i } " )
170
170
new_tree = new_bundle .create_tree (zone = tree .zone )
171
171
new_tree .text = sentence
172
172
new_bundles .append (new_bundle )
Original file line number Diff line number Diff line change @@ -39,9 +39,9 @@ def bundle_id(self, bundle_id):
39
39
tree ._sent_id = bundle_id + '/' + tree .zone # pylint: disable=protected-access
40
40
41
41
def __str__ (self ):
42
- if self .bundle_id is None :
42
+ if self ._bundle_id is None :
43
43
return 'bundle without id'
44
- return "bundle id='%s'" % self .bundle_id
44
+ return f "bundle id='{ self ._bundle_id } '"
45
45
46
46
def __iter__ (self ):
47
47
return iter (self .trees )
@@ -91,6 +91,10 @@ def add_tree(self, root):
91
91
if root .zone is None :
92
92
root ._zone = ''
93
93
self .check_zone (root .zone )
94
+ if self ._bundle_id :
95
+ root ._sent_id = self ._bundle_id
96
+ if root .zone :
97
+ root ._sent_id += '/' + root .zone
94
98
root .bundle = self
95
99
self .trees .append (root )
96
100
doc_json = root .json .get ('__doc__' )
@@ -107,7 +111,7 @@ def remove(self):
107
111
108
112
def address (self ):
109
113
"""Return bundle_id or '?' if missing."""
110
- return self .bundle_id if self .bundle_id is not None else '?'
114
+ return self ._bundle_id if self ._bundle_id is not None else '?'
111
115
112
116
def draw (self , ** kwargs ):
113
117
"""Pretty print the trees using TextModeTrees."""
You can’t perform that action at this time.
0 commit comments