# prototype to translate a system to text into dictionary
# as a type of structured text
import numpy as np
import json

# what is the proper way to store radicals with dictionary?
# use json

data = json.load(open('dict.json', 'r'))

# the essence of the program is to introduce noise to disrupt 
# the mapping relation of the dictionary. 
# learning rules is also essential to machine learning, which

noise = np.random.randint(1,3)

for i in data:
    i["numeral"] = int(i["numeral"]) 
    i["numeral"] += noise

# write to a new json file
with open('new.json','w') as w_file:
    json.dump(data,w_file, indent=4)

# test with an existing corpus 
# try a chinese dictionary and a latin dictionary
# and any other types of dictionary structures, remix!

# current rule
# 1 <= key <= 3, silk; 4 <= key <= 6, earth; 7 <= key <= 9, water

# then when i query the dictionary again, 
# the rule is disrupted, the message is disrupted
# the rule is disrupted by adding a simple number 
# are there more disruptive and complex rules? 

