Skip to content

Commit bac4010

Browse files
committed
Update runes and old-norse-tutorial
1 parent 05f4184 commit bac4010

1 file changed

Lines changed: 114 additions & 129 deletions

File tree

languages/old-norse/runes.ipynb

Lines changed: 114 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
"metadata": {},
66
"source": [
77
"# Runes\n",
8-
"Note: in order to use this Jupyter notebook, you need at least python 3.6 or above."
8+
"Note: in order to use this **Jupyter notebook**, you need at least **python 3.6** or above."
99
]
1010
},
1111
{
1212
"cell_type": "markdown",
1313
"metadata": {},
1414
"source": [
15+
"### Configuration\n",
16+
"\n",
1517
"Install required modules.\n",
1618
"```bash\n",
1719
"$ sudo pip3.6 install requests lxml \n",
@@ -22,33 +24,29 @@
2224
"cell_type": "markdown",
2325
"metadata": {},
2426
"source": [
25-
"Configure ipython.\n",
27+
"Configure **ipython**.\n",
2628
"\n",
2729
"```bash\n",
2830
"$ ipython profile create\n",
2931
"$ ipython locate\n",
3032
"$ nano .ipython/profile_default/ipython_config.py\n",
3133
"```\n",
32-
" Add it a the end of the file (without '#'):\n",
34+
" Add it a the end of the file:\n",
3335
"```bash\n",
3436
"c.InteractiveShellApp.exec_lines = [\n",
35-
" 'import sys; sys.path.append(\"/home/<username>/<path to runes-analyzer>\")'\n",
37+
" 'import sys; sys.path.append(\"/home/pi/cltk_data\")'\n",
3638
"]\n",
3739
"```\n",
38-
" And... It's done!"
40+
"It is necessary to do that because it makes things easier to utilize data furnished by CLTK. You will see later in the notebook how it is used.\n",
41+
"\n",
42+
"And... It's done!"
3943
]
4044
},
4145
{
4246
"cell_type": "markdown",
4347
"metadata": {},
4448
"source": [
45-
"In a shell, install the module **runesanalyzer**\n",
46-
"```bash\n",
47-
"$ git clone https://github.com/cltk/runes-analyzer.git\n",
48-
"$ cd runes-analyzer\n",
49-
"$ python3.6 setup.py install \n",
50-
"```\n",
51-
"Install the kernel associated with python3.6 [https://ipython.readthedocs.io/en/stable/install/kernel_install.html](https://ipython.readthedocs.io/en/stable/install/kernel_install.html) "
49+
"Install the **kernel** associated with **python3.6** [https://ipython.readthedocs.io/en/stable/install/kernel_install.html](https://ipython.readthedocs.io/en/stable/install/kernel_install.html) "
5250
]
5351
},
5452
{
@@ -61,6 +59,15 @@
6159
"```"
6260
]
6361
},
62+
{
63+
"cell_type": "markdown",
64+
"metadata": {},
65+
"source": [
66+
"### Runes and CLTK\n",
67+
"\n",
68+
"How can we work on runes with CLK?"
69+
]
70+
},
6471
{
6572
"cell_type": "code",
6673
"execution_count": 1,
@@ -79,22 +86,22 @@
7986
},
8087
{
8188
"cell_type": "code",
82-
"execution_count": 2,
83-
"metadata": {},
84-
"outputs": [
85-
{
86-
"name": "stdout",
87-
"output_type": "stream",
88-
"text": [
89-
"[ᚠ, ᚢ, ᚦ, ᚨ, ᚱ, ᚲ, ᚷ, ᚹ, ᚺ, ᚾ, ᛁ, ᛃ, ᛇ, ᛈ, ᛉ, ᛊ, ᛏ, ᛒ, ᛖ, ᛗ, ᛚ, ᛜ, ᛟ, ᛞ]\n",
90-
"[ᚠ, ᚢ, ᚦ, ᚭ, ᚱ, ᚴ, ᚼ, ᚾ, ᛁ, ᛅ, ᛋ, ᛏ, ᛒ, ᛖ, ᛘ, ᛚ, ᛦ]\n",
91-
"[ᚠ, ᚢ, ᚦ, ᚭ, ᚱ, ᚴ, ᚽ, ᚿ, ᛁ, ᛅ, ᛌ, ᛐ, ᛓ, ᛖ, ᛙ, ᛚ, ᛧ]\n"
92-
]
93-
}
94-
],
89+
"execution_count": null,
90+
"metadata": {},
91+
"outputs": [],
9592
"source": [
96-
"for alphabet in [runes.ELDER_FUTHARK, runes.YOUNGER_FUTHARK, runes.SHORT_TWIG_YOUNGER_FUTHARK]:\n",
97-
" print(alphabet)"
93+
"\n",
94+
"from old_norse.text import old_norse_runic_transcriptions\n",
95+
"from old_norse import *\n",
96+
"#text.old_norse_runic_transcription\n",
97+
"#from old_norse_runic_transcriptions import *\n",
98+
"#old_norse_runic_transcriptions.denmark\n",
99+
"#help(old_norse_runic_transcriptions)\n",
100+
"from old_norse.text.old_norse_runic_transcriptions.denmark.data import little_jelling_stone \n",
101+
"little_jelling_stone \n",
102+
"#help(text)\n",
103+
"#import sys\n",
104+
"#sys.path"
98105
]
99106
},
100107
{
@@ -104,92 +111,103 @@
104111
"The oldest runic inscriptions found are from 200 AC. They have always denoted Germanic languages. Until the 8th century, the elder *futhark* alphabet was used. It was compouned with 24 characters: ᚠ, ᚢ, ᚦ, ᚨ, ᚱ, ᚲ, ᚷ, ᚹ, ᚺ, ᚾ, ᛁ, ᛃ, ᛇ, ᛈ, ᛉ, ᛊ, ᛏ, ᛒ, ᛖ, ᛗ, ᛚ, ᛜ, ᛟ, ᛞ. The word *Futhark* comes from the 6 first characters of the alphabet: ᚠ (f), ᚢ (u), ᚦ (th), ᚨ (a), ᚱ (r), ᚲ (k). Later, this alphabet was reduced to 16 runes, the *younger futhark* ᚠ, ᚢ, ᚦ, ᚭ, ᚱ, ᚴ, ᚼ, ᚾ, ᛁ, ᛅ, ᛋ, ᛏ, ᛒ, ᛖ, ᛘ, ᛚ, ᛦ, with more ambiguity on sounds. Shapes of runes may vary according to which matter they are carved on, that is why there is a variant of the *younger futhark* like this: ᚠ, ᚢ, ᚦ, ᚭ, ᚱ, ᚴ, ᚽ, ᚿ, ᛁ, ᛅ, ᛌ, ᛐ, ᛓ, ᛖ, ᛙ, ᛚ, ᛧ."
105112
]
106113
},
114+
{
115+
"cell_type": "markdown",
116+
"metadata": {},
117+
"source": [
118+
"Get the available runic alphabets with **RunicAlphabetName**"
119+
]
120+
},
107121
{
108122
"cell_type": "code",
109-
"execution_count": 3,
123+
"execution_count": null,
110124
"metadata": {},
111125
"outputs": [],
112126
"source": [
113-
"from cltk.corpus.old_norse import runes"
127+
"from cltk.corpus.old_norse.runes import RunicAlphabetName"
128+
]
129+
},
130+
{
131+
"cell_type": "code",
132+
"execution_count": null,
133+
"metadata": {},
134+
"outputs": [],
135+
"source": [
136+
"for name in RunicAlphabetName:\n",
137+
" print(name.value)"
114138
]
115139
},
116140
{
117141
"cell_type": "markdown",
118142
"metadata": {},
119143
"source": [
120-
"Get the available runic alphabets"
144+
"Retrieve the contents of the alphabets:"
121145
]
122146
},
123147
{
124148
"cell_type": "code",
125-
"execution_count": 4,
149+
"execution_count": null,
126150
"metadata": {},
127151
"outputs": [],
128152
"source": [
129-
"from cltk.corpus.old_norse.runes import RunicAlphabetName"
153+
"for alphabet in [runes.ELDER_FUTHARK, runes.YOUNGER_FUTHARK, runes.SHORT_TWIG_YOUNGER_FUTHARK]:\n",
154+
" print(alphabet)"
155+
]
156+
},
157+
{
158+
"cell_type": "markdown",
159+
"metadata": {},
160+
"source": [
161+
"### Runic inscriptions\n",
162+
"\n",
163+
"May I get examples from the real world? Of course! For that, we use **CorpusImporter** class from CLTK to import the data contained in a CLTK project named \"old_norse_runic_transcriptions\"."
130164
]
131165
},
132166
{
133167
"cell_type": "code",
134-
"execution_count": 5,
135-
"metadata": {},
136-
"outputs": [
137-
{
138-
"name": "stdout",
139-
"output_type": "stream",
140-
"text": [
141-
"elder_futhark\n",
142-
"younger_futhark\n",
143-
"short_twig_younger_futhark\n"
144-
]
145-
}
146-
],
168+
"execution_count": null,
169+
"metadata": {},
170+
"outputs": [],
147171
"source": [
148-
"for name in RunicAlphabetName:\n",
149-
" print(name.value)"
172+
"import os\n",
173+
"from cltk.corpus.utils.importer import CorpusImporter\n",
174+
"\n",
175+
"onc = CorpusImporter(\"old_norse\")\n",
176+
"onc.import_corpus(\"old_norse_runic_transcriptions\")"
150177
]
151178
},
152179
{
153180
"cell_type": "markdown",
154181
"metadata": {},
155182
"source": [
156-
"Some famous runic inscriptions like the Jelling stones."
183+
"Once the corpus has been downloaded, you can visualize ome famous runic inscriptions like the Jelling stones in the *data.py* file."
157184
]
158185
},
159186
{
160187
"cell_type": "code",
161-
"execution_count": 6,
162-
"metadata": {},
163-
"outputs": [
164-
{
165-
"data": {
166-
"text/plain": [
167-
"'᛬ᚴᚢᚱᛘᛦ᛬ᚴᚢᚾᚢᚴᛦ᛬ᚴ(ᛅᚱ)ᚦᛁ᛬ᚴᚢᛒᛚ᛬ᚦᚢᛋᛁ᛬ᛅ(ᚠᛏ)᛬ᚦᚢᚱᚢᛁ᛬ᚴᚢᚾᚢ᛬ᛋᛁᚾᛅ᛬ᛏᛅᚾᛘᛅᚱᚴᛅᛦ᛬ᛒᚢᛏ᛬'"
168-
]
169-
},
170-
"execution_count": 6,
171-
"metadata": {},
172-
"output_type": "execute_result"
173-
}
174-
],
175-
"source": [
176-
"little_jelling_stone = '᛬ᚴᚢᚱᛘᛦ᛬ᚴᚢᚾᚢᚴᛦ᛬ᚴ(ᛅᚱ)ᚦᛁ᛬ᚴᚢᛒᛚ᛬ᚦᚢᛋᛁ᛬ᛅ(ᚠᛏ)᛬ᚦᚢᚱᚢᛁ᛬ᚴᚢᚾᚢ᛬ᛋᛁᚾᛅ᛬ᛏᛅᚾᛘᛅᚱᚴᛅᛦ᛬ᛒᚢᛏ᛬'\n",
188+
"execution_count": null,
189+
"metadata": {},
190+
"outputs": [],
191+
"source": [
192+
"from old_norse.text.old_norse_runic_transcriptions.denmark.data import little_jelling_stone , big_jelling_stone\n",
177193
"little_jelling_stone"
178194
]
179195
},
180196
{
181197
"cell_type": "code",
182-
"execution_count": 7,
198+
"execution_count": null,
183199
"metadata": {},
184200
"outputs": [],
185201
"source": [
186-
"big_jelling_stone = 'ᚼᛅᚱᛅᛚᛏᚱ᛬ᚴᚢᚾᚢᚴᛦ᛬ᛒᛅᚦ᛬ᚴᛅᚢᚱᚢᛅ ᚴᚢᛒᛚ᛬ᚦᛅᚢᛋᛁ᛬ᛅᚠᛏ᛬ᚴᚢᚱᛘ ᚠᛅᚦᚢᚱ ᛋᛁᚾ ᛅᚢᚴ ᛅᚠᛏ᛬ᚦᚭᚢᚱᚢᛁ᛬ᛘᚢᚦᚢᚱ᛬ᛋᛁᚾᛅ᛬ᛋᛅ ᚼᛅᚱᛅᛚᛏᚱ(᛬)ᛁᛅᛋ᛬ᛋᚭᛦ᛫ᚢᛅᚾ᛫ᛏᛅᚾᛘᛅᚢᚱᚴ\\nᛅᛚᛅ᛫ᛅᚢᚴ᛫ᚾᚢᚱᚢᛁᚴ\\n᛫ᛅᚢᚴ᛫ᛏ(ᛅ)ᚾᛁ(᛫ᚴᛅᚱᚦᛁ᛫)ᚴᚱᛁᛋᛏᚾᚭ'"
202+
"big_jelling_stone"
187203
]
188204
},
189205
{
190206
"cell_type": "markdown",
191207
"metadata": {},
192208
"source": [
209+
"### Encoding and data format\n",
210+
"\n",
193211
"Runes are encoded in UTF-8 from \\u16A0 ᚠ to \\u16FF ᛪ. See https://en.wikipedia.org/wiki/Runic_(Unicode_block)"
194212
]
195213
},
@@ -205,20 +223,9 @@
205223
},
206224
{
207225
"cell_type": "code",
208-
"execution_count": 8,
209-
"metadata": {},
210-
"outputs": [
211-
{
212-
"data": {
213-
"text/plain": [
214-
""
215-
]
216-
},
217-
"execution_count": 8,
218-
"metadata": {},
219-
"output_type": "execute_result"
220-
}
221-
],
226+
"execution_count": null,
227+
"metadata": {},
228+
"outputs": [],
222229
"source": [
223230
"runes.ELDER_FUTHARK[0]"
224231
]
@@ -232,20 +239,9 @@
232239
},
233240
{
234241
"cell_type": "code",
235-
"execution_count": 9,
236-
"metadata": {},
237-
"outputs": [
238-
{
239-
"data": {
240-
"text/plain": [
241-
""
242-
]
243-
},
244-
"execution_count": 9,
245-
"metadata": {},
246-
"output_type": "execute_result"
247-
}
248-
],
242+
"execution_count": null,
243+
"metadata": {},
244+
"outputs": [],
249245
"source": [
250246
"runes.Rune(runes.RunicAlphabetName.elder_futhark, \"\\u16A0\", \"f\", \"f\", \"fehu\")"
251247
]
@@ -254,36 +250,35 @@
254250
"cell_type": "markdown",
255251
"metadata": {},
256252
"source": [
257-
"Use the **Transcriber** class to get a basic transcription of a runic inscription."
253+
"### Runic transcription\n",
254+
"Use the **Transcriber** class to get a basic transcription of a runic inscription. To transcribe correctly a runic inscription, you have to take care about which runic alphabets it was written in. In the following exampls, the *younger Futhark* was used. An incorrect alphabet makes the transcription quite useless as in the second example."
258255
]
259256
},
260257
{
261258
"cell_type": "code",
262-
"execution_count": 10,
263-
"metadata": {},
264-
"outputs": [
265-
{
266-
"data": {
267-
"text/plain": [
268-
"'᛫kurmR᛫kunukR᛫k(ar)þi᛫kubl᛫þusi᛫a(ft)᛫þurui᛫kunu᛫sina᛫tanmarkaR᛫but᛫'"
269-
]
270-
},
271-
"execution_count": 10,
272-
"metadata": {},
273-
"output_type": "execute_result"
274-
}
275-
],
259+
"execution_count": null,
260+
"metadata": {},
261+
"outputs": [],
276262
"source": [
277263
"runes.Transcriber.transcribe(little_jelling_stone, runes.YOUNGER_FUTHARK)"
278264
]
279265
},
280266
{
281267
"cell_type": "code",
282-
"execution_count": 11,
268+
"execution_count": null,
283269
"metadata": {},
284270
"outputs": [],
285271
"source": [
286-
"from runesanalyzer import scraper"
272+
"runes.Transcriber.transcribe(little_jelling_stone, runes.ELDER_FUTHARK)"
273+
]
274+
},
275+
{
276+
"cell_type": "code",
277+
"execution_count": null,
278+
"metadata": {},
279+
"outputs": [],
280+
"source": [
281+
"from old_norse.text.old_norse_runic_transcriptions.sweden import scraper"
287282
]
288283
},
289284
{
@@ -295,33 +290,23 @@
295290
},
296291
{
297292
"cell_type": "code",
298-
"execution_count": 12,
293+
"execution_count": null,
299294
"metadata": {},
300-
"outputs": [
301-
{
302-
"data": {
303-
"text/plain": [
304-
"<function runesanalyzer.scraper.retrieve_sweden_runic_inscription()>"
305-
]
306-
},
307-
"execution_count": 12,
308-
"metadata": {},
309-
"output_type": "execute_result"
310-
}
311-
],
295+
"outputs": [],
312296
"source": [
313-
"scraper.retrieve_sweden_runic_inscription"
297+
"scraper.retrieve_sweden_runic_inscriptions"
314298
]
315299
},
316300
{
317301
"cell_type": "markdown",
318302
"metadata": {},
319303
"source": [
320304
"Future tasks:\n",
321-
"* normalizing runic inscriptions and transcriptions\n",
322-
"* making a statistics module to analyze frequencies of words, runes, spellings in runic inscriptions.\n",
323-
"* getting more runic inscriptions from Norway, Denmark, etc\n",
324-
"* using phonetical rules [module](https://github.com/cltk/cltk/blob/master/cltk/phonology/utils.py) to get a normalized pronunciation of Old norse inscriptions written with runes.\n",
305+
"* normalizing runic inscriptions and transcriptions,\n",
306+
"* tag runic inscriptions with locations and estimated dates,\n",
307+
"* making a statistics module to analyze frequencies of words, runes, spellings in runic inscriptions,\n",
308+
"* getting more runic inscriptions from Norway, Denmark, etc,\n",
309+
"* using phonetical rules [module](https://github.com/cltk/cltk/blob/master/cltk/phonology/utils.py) to get a normalized, pronunciation of Old norse inscriptions written with runes.\n",
325310
" "
326311
]
327312
},

0 commit comments

Comments
 (0)