main
onebigear 2 years ago
parent e1dae902cc
commit 8b94ab0e3a

@ -0,0 +1,30 @@
[
{
"letter": "silk-1",
"radical": "silk",
"numeral": "1"
},
{
"letter": "silk-2",
"radical": "silk",
"numeral": "2"
},
{
"letter": "silk-3",
"radical": "silk",
"numeral": "3"
},
{
"letter": "earth-1",
"radical": "earth",
"numeral": "4"
}
]

@ -0,0 +1,50 @@
# 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?

@ -0,0 +1,17 @@
import numpy as np
yong_grid = [[0,0,0,0,1,1,0,0,0,0],
[0,0,1,1,1,1,0,0,1,0],
[0,0,0,0,0,1,0,1,0,0],
[0,0,0,0,0,1,1,0,0,0],
[0,1,1,1,1,1,1,0,0,0],
[0,0,0,1,0,1,1,0,0,0],
[0,0,1,0,0,1,0,1,0,0],
[0,1,0,0,0,1,0,0,1,0],
[0,0,0,1,0,1,0,0,0,0],
[0,0,0,0,1,1,0,0,0,0]]
print(np.matrix(yong_grid))
from matplotlib import pyplot as plt
im = plt.imshow(yong_grid, cmap="copper_r")
plt.show()
Loading…
Cancel
Save