1 # This script checks if there are any digits (0-9) in labels or tags.
2 # The purpose is to see if it will be viable to leave spaces off of
3 # the "$nnn" IDs for de-duplicated words in the emoji data "compression".
4
5 require 'json'
6 json_in = ARGF.read
7 list = JSON.parse(json_in)
8
9 numcnt = 0
10
11 list.each do |emoj|
12 # labels containing 0-9
13 if emoj['label'].match? /[0-9]/
14 puts "Digit in label '#{emoj['label']}'"
15 numcnt += 1
16 end
17
18 # tags containing 0-9
19 dt = emoj['tags'].filter { |t| t.match? /[0-9]/ }
20 dt.each do |t|
21 puts "Digit in tag #{t} (for '#{emoj['label']}')"
22 numcnt += 1
23 end
24 end
25
26 if numcnt > 1
27 puts "Digit found! (#{numcnt} to be exact)"
28 else
29 puts "No digits found."
30 end