You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.3 KiB
Python

# 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
for i in data:
print(i["letter"])
# modify numeral for letter and update json file
i["numeral"] = "updated value nul"
print(i["numeral"])
for i in data:
print(i)
# how to save to json file
# the problem is, dictionary keys are saved as strings
# using numerical update can apply?
# current rule
# 1 <= key <= 3, silk; 4 <= key <= 6, earth; 7 <= key <= 9, water
# add noise to rule
# there is some noise
noise = np.random.randint(1,3)
# loop through keys, add noise to key value
# say noise is 2, every key adds 2
# dict = { '3':'silk-1', '4':'silk-2', '5':'silk-3',
# '6':'earth-1', '7':'earth-2', '8':'earth-3',
# '9':'water-1', '10':'water-2', '11':'water-3',
# }
# 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?