Skip to content

Instantly share code, notes, and snippets.

@MatthewRDodds
Created March 19, 2018 15:27
Show Gist options
  • Save MatthewRDodds/2db339c4e57d905e681479b261942230 to your computer and use it in GitHub Desktop.
Save MatthewRDodds/2db339c4e57d905e681479b261942230 to your computer and use it in GitHub Desktop.
Text complication script lols
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