Created
March 19, 2018 15:27
-
-
Save MatthewRDodds/2db339c4e57d905e681479b261942230 to your computer and use it in GitHub Desktop.
Text complication script lols
This file contains hidden or 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
require 'thesaurus' | |
new_text = "" | |
text = ARGV[0] | |
words = text.split(' ') | |
words.each do |word| | |
syns = Thesaurus.lookup(word.downcase).map(&:words).flatten! | |
if !syns.nil? && syns.any? | |
new_text << syns.sort_by(&:length).last | |
else | |
new_text << word | |
end | |
end | |
puts new_text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment