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):
153153 orig_bundle_id = bundle .bundle_id
154154 bundle .bundle_id = orig_bundle_id + '-1'
155155 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 } " )
157157 new_tree .zone = tree .zone
158158 new_bundle .add_tree (new_tree )
159159 new_bundles .append (new_bundle )
@@ -166,7 +166,7 @@ def process_document(self, doc):
166166 bundle .bundle_id = orig_bundle_id + '-1'
167167 tree .text = sentences [0 ]
168168 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 } " )
170170 new_tree = new_bundle .create_tree (zone = tree .zone )
171171 new_tree .text = sentence
172172 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):
3939 tree ._sent_id = bundle_id + '/' + tree .zone # pylint: disable=protected-access
4040
4141 def __str__ (self ):
42- if self .bundle_id is None :
42+ if self ._bundle_id is None :
4343 return 'bundle without id'
44- return "bundle id='%s'" % self .bundle_id
44+ return f "bundle id='{ self ._bundle_id } '"
4545
4646 def __iter__ (self ):
4747 return iter (self .trees )
@@ -91,6 +91,10 @@ def add_tree(self, root):
9191 if root .zone is None :
9292 root ._zone = ''
9393 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
9498 root .bundle = self
9599 self .trees .append (root )
96100 doc_json = root .json .get ('__doc__' )
@@ -107,7 +111,7 @@ def remove(self):
107111
108112 def address (self ):
109113 """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 '?'
111115
112116 def draw (self , ** kwargs ):
113117 """Pretty print the trees using TextModeTrees."""
You can’t perform that action at this time.
0 commit comments