Skip to content

Commit 108f7eb

Browse files
committed
clean up token count logic
1 parent 7ea37f4 commit 108f7eb

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
@@ -107,7 +107,6 @@ def flush_block
107107
return
108108
end
109109

110-
num_tokens = 0
111110
num_words = 0
112111
num_words_current_line = 0
113112
num_words_in_wrapped_lines = 0
@@ -123,7 +122,6 @@ def flush_block
123122
elsif ANCHOR_TEXT_END == token
124123
@in_anchor_text = false
125124
elsif is_word?(token)
126-
num_tokens += 1
127125
num_words += 1
128126
num_words_current_line += 1
129127
num_linked_words += 1 if @in_anchor_text
@@ -135,12 +133,10 @@ def flush_block
135133
current_line_length = token_length
136134
num_words_current_line = 1
137135
end
138-
else
139-
num_tokens += 1
140136
end
141137
end
142138

143-
return if num_tokens == 0
139+
return if tokens.empty?
144140

145141
num_words_in_wrapped_lines = 0
146142
if num_wrapped_lines == 0

0 commit comments

Comments
 (0)