# This script checks if there are any digits (0-9) in labels or tags.
# The purpose is to see if it will be viable to leave spaces off of
# the "$nnn" IDs for de-duplicated words in the emoji data "compression".

require 'json'
json_in = ARGF.read
list = JSON.parse(json_in)

numcnt = 0

list.each do |emoj|
  # labels containing 0-9
  if emoj['label'].match? /[0-9]/
    puts "Digit in label '#{emoj['label']}'"
    numcnt += 1
  end

  # tags containing 0-9
  dt = emoj['tags'].filter { |t| t.match? /[0-9]/ }
  dt.each do |t|
    puts "Digit in tag #{t} (for '#{emoj['label']}')"
    numcnt += 1
  end
end

if numcnt > 1
  puts "Digit found! (#{numcnt} to be exact)"
else
  puts "No digits found."
end
