Skip to content

Instantly share code, notes, and snippets.

@duhaime
Last active March 21, 2019 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duhaime/36a4312b63950fdaea78b5e7a885ecb0 to your computer and use it in GitHub Desktop.
Save duhaime/36a4312b63950fdaea78b5e7a885ecb0 to your computer and use it in GitHub Desktop.
Extract Voynich Words
[
[
[
"tshol",
6,
6,
[
"f99r",
"f23r",
"f23v"
]
],
[
"schoal",
1,
1,
[
"f11r"
]
],
[
"cfhy",
6,
6,
[
"f32v",
"f53r",
"f22r"
]
],
[
"shfydaiin",
1,
1,
[
"f11r"
]
],
[
"cphy",
16,
15,
[
"f1r",
"f86v6",
"f47r"
]
],
[
"shey",
283,
99,
[
"f46r",
"f1r",
"f45r"
]
],
[
"tchody",
8,
8,
[
"f7v",
"f95v1",
"f95v2"
]
],
[
"shoyty",
1,
1,
[
"f11r"
]
],
[
"socthody",
1,
1,
[
"f11r"
]
],
[
"qodor",
2,
2,
[
"f41r",
"f11r"
]
],
[
"y",
151,
87,
[
"f67r2",
"f1r",
"f45r"
]
],
[
"kshy",
5,
4,
[
"f7v",
"f1r",
"f39v"
]
],
[
"daiin",
864,
205,
[
"f46r",
"f1r",
"f67r2"
]
],
[
"ytchy",
20,
18,
[
"f102r2",
"f68v2",
"f73r"
]
],
[
"ytchoky",
1,
1,
[
"f11r"
]
],
[
"kchol",
21,
18,
[
"f45r",
"f17v",
"f45v"
]
],
[
"qoty",
87,
55,
[
"f46v",
"f80r",
"f106r"
]
],
[
"chol",
397,
151,
[
"f1r",
"f45r",
"f46r"
]
],
[
"cthy",
111,
63,
[
"f89v2",
"f1r",
"f45r"
]
],
[
"dor",
73,
54,
[
"f1r",
"f45r",
"f89v1"
]
],
[
"ykychy",
1,
1,
[
"f11r"
]
],
[
"choty",
37,
28,
[
"f1r",
"f15v",
"f13v"
]
],
[
"dain",
211,
100,
[
"f45r",
"f1r",
"f67r2"
]
],
[
"chaiin",
45,
34,
[
"f45r",
"f15r",
"f55v"
]
],
[
"ded",
1,
1,
[
"f11r"
]
],
[
"dchol",
26,
26,
[
"f5v",
"f51v",
"f58r"
]
],
[
"chy",
155,
101,
[
"f1r",
"f46r",
"f67r2"
]
],
[
"kchy",
30,
26,
[
"f1r",
"f15r",
"f31r"
]
],
[
"dy",
271,
137,
[
"f45r",
"f46r",
"f67r2"
]
],
[
"tchol",
13,
12,
[
"f45r",
"f47r",
"f86v3"
]
],
[
"shor",
97,
66,
[
"f45r",
"f46r",
"f15r"
]
],
[
"dky",
1,
1,
[
"f11r"
]
],
[
"shcphy",
2,
2,
[
"f11v",
"f11r"
]
],
[
"chodl",
1,
1,
[
"f11r"
]
],
[
"odl",
4,
4,
[
"f105v",
"f104v",
"f106v"
]
],
[
"ds",
2,
2,
[
"f27r",
"f11r"
]
],
[
"otol",
86,
69,
[
"f89v2",
"f1r",
"f55v"
]
],
[
"ykchor",
5,
4,
[
"f19r",
"f44v",
"f56v"
]
],
[
"dair",
106,
71,
[
"f89v2",
"f1r",
"f67r1"
]
],
[
"chody",
94,
66,
[
"f46r",
"f89v2",
"f89v1"
]
],
[
"s",
244,
125,
[
"f1r",
"f46r",
"f67r2"
]
],
[
"qotchy",
63,
47,
[
"f89v1",
"f15r",
"f80r"
]
],
[
"okchol",
15,
12,
[
"f70r1",
"f89v1",
"f69r"
]
]
],
[
[
0,
57,
36,
54,
39
],
[
1,
117,
51,
54,
30
],
[
2,
171,
27,
42,
48
],
[
3,
222,
24,
84,
54
],
[
4,
312,
33,
45,
45
],
[
5,
360,
42,
39,
33
],
[
6,
396,
39,
69,
33
],
[
7,
468,
30,
63,
39
],
[
8,
51,
72,
81,
24
],
[
9,
141,
75,
51,
21
],
[
10,
189,
81,
12,
30
],
[
11,
207,
69,
36,
36
],
[
12,
246,
78,
42,
18
],
[
13,
297,
69,
57,
30
],
[
14,
363,
69,
72,
36
],
[
15,
438,
66,
51,
33
],
[
12,
489,
66,
45,
24
],
[
16,
60,
93,
45,
36
],
[
17,
111,
102,
39,
21
],
[
18,
150,
93,
39,
36
],
[
19,
198,
102,
30,
18
],
[
20,
234,
96,
51,
33
],
[
21,
291,
96,
54,
39
],
[
22,
348,
99,
39,
18
],
[
23,
390,
99,
51,
15
],
[
12,
447,
96,
45,
15
],
[
24,
495,
87,
33,
21
],
[
25,
69,
126,
42,
18
],
[
26,
117,
126,
27,
18
],
[
27,
150,
114,
42,
30
],
[
28,
195,
120,
24,
27
],
[
12,
219,
120,
45,
18
],
[
29,
66,
141,
51,
24
],
[
30,
123,
138,
42,
24
],
[
30,
171,
141,
42,
21
],
[
31,
219,
135,
33,
33
],
[
32,
258,
120,
48,
45
],
[
12,
312,
138,
45,
15
],
[
18,
366,
123,
36,
36
],
[
28,
405,
135,
27,
27
],
[
33,
432,
135,
48,
18
],
[
12,
480,
129,
54,
18
],
[
34,
75,
165,
33,
21
],
[
35,
111,
162,
27,
21
],
[
10,
138,
168,
12,
27
],
[
36,
159,
156,
42,
33
],
[
23,
207,
162,
57,
18
],
[
37,
270,
156,
63,
36
],
[
38,
339,
156,
39,
21
],
[
39,
378,
159,
48,
30
],
[
18,
432,
150,
39,
24
],
[
40,
474,
150,
15,
18
],
[
12,
492,
150,
48,
18
],
[
41,
63,
183,
66,
33
],
[
42,
138,
180,
60,
33
],
[
18,
201,
177,
39,
30
],
[
28,
246,
183,
27,
21
]
]
]
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from PIL import Image
import numpy as np
import json
j = json.load(open('f11r.json'))
# each word describes a sequence of characters
# each coord has [word_idx, x, y, w, h]
words, coords = j
im = np.array(Image.open('f11r.jpg'), dtype=np.uint8)
# Create figure and axes
fig,ax = plt.subplots(1)
# Display the image
ax.imshow(im)
# Draw each of the boxes in j
for i in coords:
word_idx, x, y, w, h = i
# Create a Rectangle patch
rect = patches.Rectangle((x,y),w,h,linewidth=1,edgecolor='r',facecolor='none')
# Add the patch to the Axes
ax.add_patch(rect)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment