Skip to content

Commit ba6a0fd

Browse files
committed
fix Ruby example to ignore single characters
1 parent 79a9278 commit ba6a0fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

example-ruby/words.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def clear_output
1919

2020
def get_words(filepath)
2121
IO.readlines(filepath).map do |line|
22-
line.strip.downcase.split(' ')[2...-1].join(' ').split(/[^\p{L}]+/).uniq
22+
line.strip.downcase.split(' ')[2...-1].join(' ').split(/[^\p{L}]/).uniq.select { |s| s.size > 1 }
2323
end.flatten.uniq
2424
end
2525

0 commit comments

Comments
 (0)