def parse_one(tweet)
      puts "==> #{tweet['id']}" if @options.verbose
      retdict = {
        mentions: {},
        hashtags: {},
        time_of_day: 0,
        retweet: false,
        client: {
          name: "",
          url: "",
        },
        smileys: {}
      }

      # check if the tweet is actually a retweet and ignore the status text
      unless tweet['retweeted_status'].nil?
        retdict[:retweet] = true
      else
        # scan for mentions
        tweet['text'].scan USERNAME_REGEX do |user|
          hash_user = user[0].downcase
          puts "===> mentioned: #{user[0]}" if @options.verbose
          unless @config[:ignored_users].include? hash_user
            if @config[:renamed_users].include? hash_user.to_sym
              hash_user = @config[:renamed_users][hash_user.to_sym]
            end
            retdict[:mentions][hash_user] ||= {}
            retdict[:mentions][hash_user][:name] ||= user[0]
            retdict[:mentions][hash_user][:count] = retdict[:mentions][hash_user][:count].to_i.succ
            retdict[:mentions][hash_user][:example] ||= { text: tweet['text'], id: tweet['id'] }
          end
        end

        # scan for hashtags
        tweet['text'].scan HASHTAG_REGEX do |hashtag|
          hash_hashtag = hashtag[0].downcase
          puts "===> hashtag: ##{hashtag[0]}" if @options.verbose
          retdict[:hashtags][hash_hashtag] ||= {}
          retdict[:hashtags][hash_hashtag][:hashtag] ||= hashtag[0]
          retdict[:hashtags][hash_hashtag][:count] = retdict[:hashtags][hash_hashtag][:count].to_i.succ
          retdict[:hashtags][hash_hashtag][:example] ||= { text: tweet['text'], id: tweet['id'] }
        end

        # Smileys :^)
        eyes = "[xX8;:=%]"
        nose = "[-oc*^]"
        smile_regex = /(>?#{eyes}'?#{nose}[\)pPD\}\]>]|[\(\{\[<]#{nose}'?#{eyes}<?|[;:][\)pPD\}\]\>]|\([;:]|\^[_o-]*\^[';]|\\[o.]\/)/
        frown_regex = /(#{eyes}'?#{nose}[\(\[\\\/\{|]|[\)\]\\\/\}|]#{nose}'?#{eyes}|[;:][\(\/]|[\)D]:|;_+;|T_+T|-[._]+-)/

        unescaped_tweet = tweet['text'].gsub("&amp;", "&").gsub("&lt;", "<").gsub("&gt;", ">")

        unescaped_tweet.scan smile_regex do |smile|
          smile = smile[0]
          puts "===> smile: #{smile}" if @options.verbose
          retdict[:smileys][smile] ||= {frown: false}
          retdict[:smileys][smile][:smiley] ||= smile
          retdict[:smileys][smile][:count] = retdict[:smileys][smile][:count].to_i.succ
          retdict[:smileys][smile][:example] ||= { text: tweet['text'], id: tweet['id'] }
        end

        unescaped_tweet.scan frown_regex do |frown|
          break unless unescaped_tweet !~ /\w+:\/\// # http:// :^)
          frown = frown[0]
          puts "===> frown: #{frown}" if @options.verbose
          retdict[:smileys][frown] ||= {frown: true}
          retdict[:smileys][frown][:smiley] ||= frown
          retdict[:smileys][frown][:count] = retdict[:smileys][frown][:count].to_i.succ
          retdict[:smileys][frown][:example] ||= { text: tweet['text'], id: tweet['id'] }
        end
      end

      # Tweet source (aka. the client the (re)tweet was made with)
      source_matches = tweet['source'].match SOURCE_REGEX
      retdict[:client][:url]  = source_matches[1]
      retdict[:client][:name] = source_matches[2]

      # Time of day
      retdict[:time_of_day] = (tweet['created_at'].match(/^\d{4}-\d{2}-\d{2} (\d{2})/)[1].to_i + @config[:timezone_difference]) % 24

      retdict
    end
def parse_one(tweet)
      puts "==> #{tweet['id']}" if @options.verbose
      retdict = {
        mentions: {},
        hashtags: {},
        time_of_day: 0,
        retweet: false,
        client: {
          name: "",
          url: "",
        },
        smileys: {}
      }

      # check if the tweet is actually a retweet and ignore the status text
      unless tweet['retweeted_status'].nil?
        retdict[:retweet] = true
      else
        # scan for mentions
        tweet['text'].scan USERNAME_REGEX do |user|
          hash_user = user[0].downcase
          puts "===> mentioned: #{user[0]}" if @options.verbose
          unless @config[:ignored_users].include? hash_user
            if @config[:renamed_users].include? hash_user.to_sym
              hash_user = @config[:renamed_users][hash_user.to_sym]
            end
            retdict[:mentions][hash_user] ||= {}
            retdict[:mentions][hash_user][:name] ||= user[0]
            retdict[:mentions][hash_user][:count] = retdict[:mentions][hash_user][:count].to_i.succ
            retdict[:mentions][hash_user][:example] ||= { text: tweet['text'], id: tweet['id'] }
          end
        end

        # scan for hashtags
        tweet['text'].scan HASHTAG_REGEX do |hashtag|
          hash_hashtag = hashtag[0].downcase
          puts "===> hashtag: ##{hashtag[0]}" if @options.verbose
          retdict[:hashtags][hash_hashtag] ||= {}
          retdict[:hashtags][hash_hashtag][:hashtag] ||= hashtag[0]
          retdict[:hashtags][hash_hashtag][:count] = retdict[:hashtags][hash_hashtag][:count].to_i.succ
          retdict[:hashtags][hash_hashtag][:example] ||= { text: tweet['text'], id: tweet['id'] }
        end

        # Smileys :^)
        eyes = "[xX8;:=%]"
        nose = "[-oc*^]"
        smile_regex = /(>?#{eyes}'?#{nose}[\)pPD\}\]>]|[\(\{\[<]#{nose}'?#{eyes}<?|[;:][\)pPD\}\]\>]|\([;:]|\^[_o-]*\^[';]|\\[o.]\/)/
        frown_regex = /(#{eyes}'?#{nose}[\(\[\\\/\{|]|[\)\]\\\/\}|]#{nose}'?#{eyes}|[;:][\(\/]|[\)D]:|;_+;|T_+T|-[._]+-)/

        unescaped_tweet = tweet['text'].gsub("&amp;", "&").gsub("&lt;", "<").gsub("&gt;", ">")

        unescaped_tweet.scan smile_regex do |smile|
          smile = smile[0]
          puts "===> smile: #{smile}" if @options.verbose
          retdict[:smileys][smile] ||= {frown: false}
          retdict[:smileys][smile][:smiley] ||= smile
          retdict[:smileys][smile][:count] = retdict[:smileys][smile][:count].to_i.succ
          retdict[:smileys][smile][:example] ||= { text: tweet['text'], id: tweet['id'] }
        end

        unescaped_tweet.scan frown_regex do |frown|
          break unless unescaped_tweet !~ /\w+:\/\// # http:// :^)
          frown = frown[0]
          puts "===> frown: #{frown}" if @options.verbose
          retdict[:smileys][frown] ||= {frown: true}
          retdict[:smileys][frown][:smiley] ||= frown
          retdict[:smileys][frown][:count] = retdict[:smileys][frown][:count].to_i.succ
          retdict[:smileys][frown][:example] ||= { text: tweet['text'], id: tweet['id'] }
        end
      end

      # Tweet source (aka. the client the (re)tweet was made with)
      source_matches = tweet['source'].match SOURCE_REGEX
      retdict[:client][:url]  = source_matches[1]
      retdict[:client][:name] = source_matches[2]

      # Time of day
      retdict[:time_of_day] = (tweet['created_at'].match(/^\d{4}-\d{2}-\d{2} (\d{2})/)[1].to_i + @config[:timezone_difference]) % 24

      retdict
    end
Parses a single tweet object

 Returns a dict of things.