Last active
December 10, 2015 03:28
-
-
Save ChangJoo-Park/4374582 to your computer and use it in GitHub Desktop.
불용어를 제외하고 보여줌
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# Stop_words 2012-12-26 | |
stop_words = %w{the a by on for of are with just but and to the my I has some in} | |
text=%q{Korea is officially the only divided nation in the world.} | |
words = text.scan(/\w+/) | |
key_words = words.select { |word| !stop_words.include?(word)} | |
puts "문장 중 키워드의 비율은 : #{((key_words.length.to_f/words.length.to_f)*100).to_i}%" | |
puts key_words.join(' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment