Skip to content

Commit 904c582

Browse files
committed
clean up token count logic
1 parent 1e050bd commit 904c582

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/boilerpipe/sax/html_content_handler.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ def flush_block
113113
return
114114
end
115115

116-
num_tokens = 0
117116
num_words = 0
118117
num_words_current_line = 0
119118
num_words_in_wrapped_lines = 0
@@ -129,7 +128,6 @@ def flush_block
129128
elsif ANCHOR_TEXT_END == token
130129
@in_anchor_text = false
131130
elsif is_word?(token)
132-
num_tokens += 1
133131
num_words += 1
134132
num_words_current_line += 1
135133
num_linked_words += 1 if @in_anchor_text
@@ -141,12 +139,10 @@ def flush_block
141139
current_line_length = token_length
142140
num_words_current_line = 1
143141
end
144-
else
145-
num_tokens += 1
146142
end
147143
end
148144

149-
return if num_tokens == 0
145+
return if tokens.empty?
150146

151147
num_words_in_wrapped_lines = 0
152148
if num_wrapped_lines == 0

0 commit comments

Comments
 (0)