#!/usr/bin/env python3

import sys

from coldata import *


def usage():
	print(f'usage: {sys.argv[0]} [CODEPOINTS] [CONTRACTIONS]')
	print('')
	print('[CODEPOINTS]   - filename with list of codepoints')
	print('[CONTRACTIONS] - filename with list of contractions from the same collation')


if __name__ == '__main__':
	if len(sys.argv) < 3:
		usage()
		sys.exit(1)

	codepoints_file, contractions_file = sys.argv[1], sys.argv[2]
	codepoints, _ = collect_contractions(codepoints_file, contractions_file)  # codepoints already reweighted

	for c, w in codepoints:
		assert len(w) == 1
		print(f'{" ".join(c)} {w[0]:06X}')
