<commit_before>import os
import os.path
import re
import itertools

stringidre = re.compile(r"""ui_strings\.([A-Z_]+)""")
stringdatare = re.compile(r"""ui_strings\.([A-Z_]+)\s*=\s*(.*?);""")

def collect_used_string_ids(basedir):
	found = set()
	for dirpath, dirnames, filenames in os.walk(basedir):
		if dirpath.endswith("/ui-strings"): continue

		for filepath in [os.path.join(dirpath, e) for e in filenames if e.endswith(".js")]:
			data = open(filepath).read()
			used_strings = stringidre.findall(data)
			found = found | set(used_strings)

	return found<commit_msg>Fixed regexes so it detects ui strings with numbers in them<commit_after>import os
import os.path
import re
import itertools

stringidre = re.compile(r"""ui_strings\.([A-Z_0-9]+)""")
stringdatare = re.compile(r"""ui_strings\.([A-Z_0-9]+)\s*=\s*(.*?);""")

def collect_used_string_ids(basedir):
	found = set()
	for dirpath, dirnames, filenames in os.walk(basedir):
		if dirpath.endswith("/ui-strings"): continue

		for filepath in [os.path.join(dirpath, e) for e in filenames if e.endswith(".js")]:
			data = open(filepath).read()
			used_strings = stringidre.findall(data)
			found = found | set(used_strings)

	return found
{'fraction_non_alphanumeric': 0.16722408026755853, 'fraction_numerical': 0.0033444816053511705, 'mean_word_length': 5.015075376884422, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5158570', 'n_tokens_mistral': 463, 'n_tokens_neox': 437, 'n_words': 99}