Skip to content

Commit 1d49198

Browse files
committed
clean up text_block#to_s
1 parent 045c9f9 commit 1d49198

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/boilerpipe/document/text_block.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,15 @@ def merge_next(other)
7474
end
7575

7676
def to_s
77-
# "[" + offsetBlocksStart + "-" + offsetBlocksEnd + ";tl=" + tagLevel + "; nw=" + numWords + ";nwl=" + numWrappedLines + ";ld=" + linkDensity + "]\t" + (isContent ? "CONTENT" : "boilerplate") + "," + labels + "\n" + getText();
78-
labels = 'null'
79-
if !@labels.empty?
80-
labels = "[#{@labels.to_a.join(',')}]"
77+
"[#{@offset_blocks_start}-#{@offset_blocks_end};tl=#{@tag_level}; nw=#{@num_words};nwl=#{@num_wrapped_lines};ld=#{@link_density}]\t#{is_content? ? 'CONTENT' : 'BOILERPLATE'},#{labels_to_s}\n#{text}"
78+
end
79+
80+
def labels_to_s
81+
if @labels.empty?
82+
'null'
83+
else
84+
"[#{@labels.to_a.join(',')}]"
8185
end
82-
"[#{@offset_blocks_start}-#{@offset_blocks_end};tl=#{@tag_level}; nw=#{@num_words};nwl=#{@num_wrapped_lines};ld=#{@link_density}]\t#{is_content? ? 'CONTENT' : 'BOILERPLATE'},#{labels}\n#{text}"
8386
end
8487

8588
def clone

0 commit comments

Comments
 (0)