497 lines
186 KiB
Plaintext
497 lines
186 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"![Logo 1](https://git.wmi.amu.edu.pl/AITech/Szablon/raw/branch/master/Logotyp_AITech1.jpg)\n",
|
||
|
"<div class=\"alert alert-block alert-info\">\n",
|
||
|
"<h1> Modelowanie języka</h1>\n",
|
||
|
"<h2> 03. <i>N-gramy</i> [wykład]</h2> \n",
|
||
|
"<h3> Filip Graliński (2022)</h3>\n",
|
||
|
"</div>\n",
|
||
|
"\n",
|
||
|
"![Logo 2](https://git.wmi.amu.edu.pl/AITech/Szablon/raw/branch/master/Logotyp_AITech2.jpg)\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## N-gramy\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"W modelowaniu języka często rozpatruje się n-gramy, czyli podciągi o\n",
|
||
|
"rozmiarze $n$.\n",
|
||
|
"\n",
|
||
|
"Na przykład *digramy* (*bigramy*) to zbitki dwóch jednostek, np. liter albo wyrazów.\n",
|
||
|
"\n",
|
||
|
"| $n$|$n$-gram|nazwa|\n",
|
||
|
"|---|---|---|\n",
|
||
|
"| 1|1-gram|unigram|\n",
|
||
|
"| 2|2-gram|digram/bigram|\n",
|
||
|
"| 3|3-gram|trigram|\n",
|
||
|
"| 4|4-gram|tetragram|\n",
|
||
|
"| 5|5-gram|pentagram|\n",
|
||
|
"\n",
|
||
|
"**Pytanie:** Jak nazywa się 6-gram?\n",
|
||
|
"\n",
|
||
|
"Jak widać, dla symetrii mówimy czasami o unigramach, jeśli operujemy\n",
|
||
|
"po prostu na jednostkach, nie na ich podciągach.\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### N-gramy z Pana Tadeusza\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Statystyki, które policzyliśmy dla pojedynczych liter czy wyrazów, możemy powtórzyć dla n-gramów.\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"[('k', 'o', 't'), ('o', 't', 'e'), ('t', 'e', 'k')]"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"def ngrams(iter, size):\n",
|
||
|
" ngram = []\n",
|
||
|
" for item in iter:\n",
|
||
|
" ngram.append(item)\n",
|
||
|
" if len(ngram) == size:\n",
|
||
|
" yield tuple(ngram)\n",
|
||
|
" ngram = ngram[1:]\n",
|
||
|
"\n",
|
||
|
"list(ngrams(\"kotek\", 3))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Zauważmy, że policzyliśmy wszystkie n-gramy, również częściowo się pokrywające.\n",
|
||
|
"\n",
|
||
|
"Zawsze powinniśmy się upewnić, czy jest jasne, czy chodzi o n-gramy znakowe czy wyrazowe\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### 3-gramy znakowe\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
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nk81UVyeKyShW7K2UPs+l3A1vot/2ayx5mM/2fAwA4T4zfUrjpAEBdcUZHqH1GvXP+3GF3pR79eJWmrtil57/aoPlb9usvN3RUWkJUzYcEAKAOcBsY4AziHOH6yy876vnrOyg6wq65m/Zr8F9n67t1BSotr1R5pVdMpAMAggmngKuBKWTr2VRwWPe+t0zr9hSf9LUwmxQdYVfnrERd0jJVfVumqkVanGw2ThcDQCBh/KYAVgsHkDWVVXiUO22t3l2Yp0rvT//fp6EzSle0a6D7Lm2hpNjIOkoIAPgpjN8UwGrhALK2Co9X5ZVeVXp8qvR6Ven16UBJueZuKtSsjYVauGW/3JVeSVXrD38/qKV+dVFjhdtZeQEAJjF+UwCrhQMIP6WswqM5Gwv1/Ffr/aeMWzWI19iftdXFTZMNpwMA62L8pgBWCwcQzkalx6v3F+Xp+a82qOhIhSRpSId0jRncSun1og2nAwDrYfymAFYLBxDOxcGScj3/1Xq9tyhPPl/VBSMj+zfTnX2a8pQRAKhDjN8UwGrhAML5+GFnkcZ9tlqLtx2UJGUkRuuBAS10XadGrA8EgDrA+E0BrBYOIJwvn8+nT1fuUu60ddrjKpMkNU2J1f0DWqhl/XiFhUl2m02ZSTHMDgJADWP8pgBWCwcQqutIuUeTF2zTxBmbdbC04qSvJ8ZE6Nae2RrRM0v1YriNDADUBMZvCmC1cAChphx2V+qtOVv1n2U7VFrukc/nU1mFV4fdlZKk2Ei7rm6fru5Nk9StSZIa1YtWGM8jBoDzwvh
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"log_rang_log_freq('pt-3-char-ngrams-log-log', ngrams(get_characters(pan_tadeusz), 3))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### 2-gramy wyrazowe\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAtkElEQVR4nO3de3yU1YHG8eedSTK5BwIkEAg35R65ewERsAIVrRXX1taqxbW2tUUL0nZF6a5Vq6naum6l0uK62moRum1R260XvHBTQW4BylUKQkoIIUgySSCTy8z+ERKgBBhIMmfeOb/v5zN/ZOZNeD7jmPfJOe85rxMKhUICAACANTymAwAAACCyKIAAAACWoQACAABYhgIIAABgGQogAACAZSiAAAAAlqEAAgAAWIYCCAAAYBkKIAAAgGUogAAAAJahAAIAAFiGAggAAGAZCiAAAIBlKIAAAACWoQACAABYhgIIAABgGQogAACAZSiAAAAAlqEAAgAAWIYCCAAAYBkKIAAAgGUogAAAAJahAAIAAFiGAggAAGAZCiAAAIBlKIAAAACWoQACAABYhgIIAABgGQogAACAZSiAAAAAlqEAAgAAWIYCCAAAYBkKIAAAgGUogAAAAJahAAIAAFiGAggAAGAZCiAAAIBlKIAAAACWoQACAABYhgIIAABgGQogAACAZSiAAAAAlqEAAgAAWIYCCAAAYBkKIAAAgGUogAAAAJahAAIAAFiGAggAAGAZCiAAAIBlKIAAAACWoQACAABYhgIIAABgGQogAACAZSiAAAAAlqEAAgAAWIYCCAAAYJk40wHcLBgMqqioSGlpaXIcx3QcAAAQhlAopIqKCuXk5MjjsXMsjALYAkVFRcrNzTUdAwAAnIfCwkJ169bNdAwjKIAtkJaWJqnhA5Senm44DQAACIff71dubm7TedxGFMAWaJz2TU9PpwACAOAyNl++ZefENwAAgMUogAAAAJahAAIAAFiGAggAAGA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mv5K88Vpwz/KtXANd1EBAMAUCiAiJistUTOOLQh5/M1tOsyCEAAAjKAAIqKmjuqhftlpKjtSqyff5g4hAACYQAFERMV5PXr4+oY7hLzy8V79eunfVVMXNJwKAAC7UAARcZf27qCvXpyrUEjKf2Obrn56mZZsLzEdCwAAa1AAYcRjN1ykJ780WB1TE7SrtEq3v7Bad/5mtT4trTIdDQCAmOeEQiH24zhPfr9fGRkZKi8vV3p6uuk4ruSvrtUz736iFz74VHXBkBK8Hn1zbC99d/yFSvFxp0IAQOvj/E0BbBE+QK1nZ0mlHvrzZi3/pFSSlJ3u0wPXDNAXh+TIcRzD6QAAsYTzNwWwRfgAta5QKKR3tpbokb9s0d7PjkiSLu7ZXj+9cbAu6JRqOB0AIFZw/uYaQEQRx3E0cWC23r53rH74+X5Kivdq9aeHdf2cD/TXTftNxwMAIGZQABF1EuO9mnblhXr3++N0Sa9MVQbq9N3frdMjf9mi2nq2jAEAoKUogIhaOe2SNP/OS/Xtcb0lSc+v2K2b561UcXm14WQAALgbBRBRLc7r0f2TB+jXt41QWmKc1uw5rC88s1wf7iw1HQ0AANeiAMIVPj+os/5yzxgN6JKu0soa3fr8Kv3y/Z0KBlnDBADAuaIAwjV6dEjRou+O1pdHdFMwJD351nb94A8bTMcCAMB1KIBwlcR4r5788hA9fuNFchzpT+v2qajsqOlYAAC4CgUQrvSVi7trZI/2kqR3th4wnAYAAHehAMK1Jg7MliS9vZkCCADAuaAAwrUmDuwsSVq565DKj9YaTgMAgHtQAOFavTqmqE9WquqCIS3ZXmI6DgAArkEBhKs1TQNvYRoYAIBwUQDhapMGNUwDL91+UIG6esNpAAB
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"log_rang_log_freq('pt-2-word-ngrams-log-log', ngrams(get_words(pan_tadeusz), 2))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Tajemniczy język Manuskryptu Wojnicza\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"[Manuskrypt Wojnicza](https://pl.wikipedia.org/wiki/Manuskrypt_Wojnicza) to powstały w XV w. manuskrypt spisany w\n",
|
||
|
"tajemniczym alfabecie, do dzisiaj nieodszyfrowanym. Rękopis stanowi\n",
|
||
|
"jedną z największych zagadek historii (i lingwistyki).\n",
|
||
|
"\n",
|
||
|
"[Źródło: https://commons.wikimedia.org/wiki/File:Voynich<sub>Manuscript</sub><sub>(135)</sub>.jpg](./02_Jezyki/voynich135.jpg)\n",
|
||
|
"\n",
|
||
|
"Sami zbadajmy statystyczne własności tekstu manuskryptu. Użyjmy\n",
|
||
|
"transkrypcji Vnow, gdzie poszczególne znaki tajemniczego alfabetu\n",
|
||
|
"zamienione na litery alfabetu łacińskiego, cyfry i gwiazdkę. Jak\n",
|
||
|
"transkrybować manuskrypt, pozostaje sprawą dyskusyjną, natomiast wybór\n",
|
||
|
"takiego czy innego systemu transkrypcji nie powinien wpływać\n",
|
||
|
"dramatycznie na analizę statystyczną.\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"9 OR 9FAM ZO8 QOAR9 Q*R 8ARAM 29 [O82*]OM OPCC9 OP"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import requests\n",
|
||
|
"\n",
|
||
|
"voynich_url = 'http://www.voynich.net/reeds/gillogly/voynich.now'\n",
|
||
|
"voynich = requests.get(voynich_url).content.decode('utf-8')\n",
|
||
|
"\n",
|
||
|
"voynich = re.sub(r'\\{[^\\}]+\\}|^<[^>]+>|[-# ]+', '', voynich, flags=re.MULTILINE)\n",
|
||
|
"\n",
|
||
|
"voynich = voynich.replace('\\n\\n', '#')\n",
|
||
|
"voynich = voynich.replace('\\n', ' ')\n",
|
||
|
"voynich = voynich.replace('#', '\\n')\n",
|
||
|
"\n",
|
||
|
"voynich = voynich.replace('.', ' ')\n",
|
||
|
"\n",
|
||
|
"voynich[100:150]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABLAAAAEsCAYAAADTvUpQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAABLY0lEQVR4nO3deVjU1f///8fEJipMoAKiuJSGu6aWovVGU0Fzac/SSHPLXEnNLMuld7mnZaaVuZBL+jHflmUiZmqa4oJZmuSSkKYQlQhiBgqv3x/9nK8jCDMjOCPdb9c11+Wc13nOeb5wFubJOedlMgzDEAAAAAAAAOCibnF2AgAAAAAAAEBhKGABAAAAAADApVHAAgAAAAAAgEujgAUAAAAAAACXRgELAAAAAAAALo0CFgAAAAAAAFwaBSwAAAAAAAC4NApYAAAAAAAAcGkUsAAAAAAAAODSKGABAAAAAADApVHAAgAAAAAAgEujgAUAAAAAAACXRgELAAAAAAAALo0CFgAAAAAAAFwaBSwAAAAAAAC4NApYAAAAAAAAcGkUsAAAAAAAAODSKGABAAAAAADApVHAAgAAAAAAgEujgAUAAAAAAACXRgELAAAAAAAALo0CFgAAAAAAAFwaBSwAAAAAAAC4NApYAAAAAAAAcGkUsAAAAAAAAODSKGABAAAAAADApVHAAgAAAAAAgEujgAUAAAAAAACXRgELAAAAA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+v2NhYxcbGav/+/YqKirIcz83NVefOnXX
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"rang_freq_with_labels('voy-chars', get_characters(voynich))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAA2SElEQVR4nO3deXhU5cH+8fvMJJksJJOEkISYCQZlCSBbUGTRYkEqbqVardSt1PpKiwvmrVa0qz81rdalr1YUXutaKnVBqa9LcWMR2cKq7GsCBEJYMlnIJJnM74+ESMpiQpZnJuf7ua65JCcz6e2VY8/Nc57nOVYgEAgIAAAAtuEwHQAAAADtiwIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNUAABAABshgIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNUAABAABshgIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNUAABAABshgIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNUAABAABshgIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNUAABAABshgIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNUAABAABshgIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAAD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": [
|
||
|
"<matplotlib.figure.Figure>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"log_rang_log_freq('voy-log-log', get_words(voynich))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABLAAAAEsCAYAAADTvUpQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAABCNklEQVR4nO3de5xO9d7/8fdlzjPG1RyYMRmHMhGGdrRJdrQxklNpxy4d2aXkMCGRasve0e5gdLj1a5fbSCGUUqnQjkgip3JIYuTQTBTNODXDzOf3R3uu22UGY8zMWng9H4/14Frre631Weu6rrWueV/ftZbHzEwAAAAAAACAS1VyugAAAAAAAADgZAiwAAAAAAAA4GoEWAAAAAAAAHA1AiwAAAAAAAC4GgEWAAAAAAAAXI0ACwAAAAAAAK5GgAUAAAAAAABXI8ACAAAAAACAqxFgAQAAAAAAwNUIsAAAAAAAAOBqBFgAAAAAAABwNQIsAAAAAAAAuBoBFgAAAAAAAFyNAAsAAAAAAACuRoAFAAAAAAAAVyPAAgAAAAAAgKsRYAEAAAAAAMDVCLAAAAAAAADgagRYAAAAAAAAcDUCLAAAAAAAALgaARYAAAAAAABcjQALAAAAAAAArkaABQAAAAAAAFcjwAIAAAAAAICrEWABAAAAAADA1QiwAAAAAAAA4GoEWAAAAAAAAHA1AiwAAAAAAAC4GgEWAAAAAAAAXI0ACwAAAAAAAK5GgAUAAAAAAABXI8ACAAAAAACAqxFgAQAAAAAAwNUIsAAAAAAAAOBqgU4XgHNPQUGBfvzxR0VGRsrj8ThdDgA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RRdp4PB7l5+dXaF0AAAAAAABuQ4DlsIKCAqdLAAAAAAAAcDWugeUiv/32W5nNa+zYsfJ4PEpNTfWNMzONGjVKCQkJCgsLU5s2bbR+/Xq/5+Xm5mrAgAGKjY1VRESEunbtqp07d5ZZXQAAAAAAAKeLAMth+fn5+sc//qELL7xQlStX1tatWyVJjz76qCZOnFiqea5YsUL//ve/1bhxY7/xTz31lMaNG6cXX3xRK1asUHx8vNq3b6/9+/f72qSmpmr27NmaPn26lixZogMHDqhz586cyggAAAAAABxDgOWwJ554Qunp6XrqqacUHBzsG5+cnKxXX331tOd34MAB9erVS6+88oqioqJ8481M48eP18iRI9W9e3c1atRIkydP1qFDhzR16lRJUnZ2tiZOnKhnn31W7dq10x/+8Ae9/vrr+uabb7RgwYIzX1kAAAAAAIBSIMBy2GuvvaZ///vf6tWrlwICAnzjGzdurG+//fa053f//ferU6dOateund/4jIwMZWVlKSUlxTcuJCRErVu31tKlSyVJK1eu1JEjR/zaJCQkqFGjRr42AAAAAAAAFY2LuDts165dqlu3bpHxBQUFOnLkyGnNa/r06Vq1apVWrFhRZFpWVpYkKS4uzm98XFycfvjhB1+b4OBgv55bhW0Kn1+c3Nxc5ebm+h7n5OScVt0AAAAAAAAnQw8shzVs2FCLFy8uMn7mzJn6wx/+UOL57NixQ4MGDdLrr7+u0NDQE7bzeDx+j82syLjjnarN2LFj5fV6fUNiYmKJ6wYAAAAAADgVemA57O9//7tuu+027dq1SwUFBXr77be1adMmvfbaa3r//fdLPJ+VK1dq9+7datq0qW9cfn6+PvvsM7344ovatGmTpN97WVWvXt3XZvfu3b5eWfHx8crLy9O+ffv8emHt3r1bLVu2POGyR4wYocGDB/se5+TkEGIBAAAAAIAyQw8sh3Xp0kVvvvmm5s6dK4/Ho8cee0wbN27Ue++9p/bt25d4Pm3bttU333yjNWvW+IZmzZqpV69eWrNmjS666CLFx8dr/vz5vufk5eVp0aJ
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"rang_freq_with_labels('voy-words-20', get_words(voynich), top=20)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAA2SElEQVR4nO3deXhU5cH+8fvMJJksJJOEkISYCQZlCSBbUGTRYkEqbqVardSt1PpKiwvmrVa0qz81rdalr1YUXutaKnVBqa9LcWMR2cKq7GsCBEJYMlnIJJnM74+ESMpiQpZnJuf7ua65JCcz6e2VY8/Nc57nOVYgEAgIAAAAtuEwHQAAAADtiwIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNUAABAABshgIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNUAABAABshgIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNUAABAABshgIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNUAABAABshgIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNUAABAABshgIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNUAABAABshgIIAABgMxRAAAAAm6EAAgAA2AwFEAAAwGYogAAAADZDAQQAALAZCiAAAIDNhJkOEMpqa2u1Z88excbGyrIs03EAAEATBAIBlZaWKi0tTQ6HPcfCKI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display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"log_rang_log_freq('voy-words-log-log', get_words(voynich))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Język DNA\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Kod genetyczny przejawia własności zaskakująco podobne do języków naturalnych.\n",
|
||
|
"Przede wszystkim ma charakter dyskretny, genotyp to ciąg symboli ze skończonego alfabetu.\n",
|
||
|
"Podstawowe litery są tylko cztery, reprezentują one nukleotydy, z których zbudowana jest nić DNA:\n",
|
||
|
"a, g, c, t.\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"TATAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTA"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import requests\n",
|
||
|
"\n",
|
||
|
"dna_url = 'https://raw.githubusercontent.com/egreen18/NanO_GEM/master/rawGenome.txt'\n",
|
||
|
"dna = requests.get(dna_url).content.decode('utf-8')\n",
|
||
|
"\n",
|
||
|
"dna = ''.join(dna.split('\\n')[1:])\n",
|
||
|
"dna = dna.replace('N', 'A')\n",
|
||
|
"\n",
|
||
|
"dna[0:100]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABLAAAA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UWABAAAAAADA0iiwAAAAAAAAYGkUWAAAAAAAALA0CiwAAAAAAABYGgUWAAAAAAAALI0CCwAAAAAAAJZGgQUAAAAAAABLo8ACAAAAAACApVFgAQAAAAAAwNIosAAAAAAAAGBpvmYHsKrjx4+rtLRUtbW1amtrczt2//33m5QKAAAAAADA+1BgefDHP/5RY8aMUWNjowIDA2Wz2YxjNpuNAgsAAAAAAKATcQmhpP/5n//R//3f/xnPJ0+erAceeEAnTpzQ8ePHVVdXZzyOHTtmYlIAAAAAAADvQ4ElqWfPnvr5z3+ujz/+WJJ06NAhZWVlqUePHiYnAwAAAAAAAAWWpDvuuENvvPGGfvOb30iSkpOTjTILAAAAAAAA5uIeWN+KjY3Vli1bJEkjR47Uf/zHf2jXrl2KjY1Vt27d3GZTU1PNiAgAAAAAAOCVKLD+gb+/vyQpMzNTkjR79ux2MzabTa2trZ2aCwAAAAAAwJtRYHnQ1tZmdgQAAAAAAAB8i3tgfYdvvvnG7AgAAAAAAABejQLLg9bWVv3ud79T79691bNnT3311VeSpCeffFLLli0zOR0AAAAAAIB3ocDyYM6cOSooKNDcuXPl5+dnrMfGxuqll14yMRkAAAAAAID3ocDy4NVXX9WLL76oMWPGyMfHx1gfOHCgPv/8cxOTAQAAAAAAeB8KLA8OHTqkfv36tVtva2tTS0uLCYkAAAAAAAC8FwWWB9ddd50++OCDdutr167VjTfeaEIiAAAAAAAA7+VrdgAreuqpp5Senq5
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"rang_freq_with_labels('dna-chars', get_characters(dna))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### Tryplety — znaczące cząstki genotypu\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Nukleotydy rzeczywiście są jak litery, same w sobie nie niosą\n",
|
||
|
"znaczenia. Dopiero ciągi trzech nukleotydów, *tryplety*, kodują jeden\n",
|
||
|
"z dwudziestu aminokwasów.\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABLAAAAEsCAYAAADTvUpQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAA9HUlEQVR4nO3de1hU9b7H8c8EgogwgQRE4qU0UtEuVEq2A1NBN4hd9rYTRllutU2JpB7TPBlWonkvOXYxDfOSZWal7gg1MQlJQ6lM0txqooFaIl4yQJzzR4/rNKLuGLG1pPfreeZ5nLW+rPnMqFw+/NYam8PhcAgAAAAAAACwqMvMDgAAAAAAAACcDwUWAAAAAAAALI0CCwAAAAAAAJZGgQUAAAAAAABLo8ACAAAAAACApVFgAQAAAAAAwNIosAAAAAAAAGBpFFgAAAAAAACwNAosAAAAAAAAWBoFFgAAAAAAACyNAgsAAAAAAACWRoEFAAAAAAAAS6PAAgAAAAAAgKVRYAEAAAAAAMDSKLAAAAAAAABgaRRYAAAAAAAAsDQKLAAAAAAAAFgaBRYAAAAAAAAsjQILAAAAAAAAlkaBBQAAAAAAAEujwAIAAAAAAIClUWABAAAAAADA0iiwAAAAAAAAYGkUWAAAAAAAALA0CiwAAAAAAABYGgUWAAAAAAAALI0CCwAAAAAAAJZGgQUAAAAAAABLo8ACAAAAAACApVFgAQAAAAAAwNIosAAAAAAAAGBpFFgAAAAAAACwNAosAAAAAAAAWBoFFgAAAAAAACzN3ewAq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matplotlib.figure.Figure>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"genetic_code = {\n",
|
||
|
" 'ATA':'I', 'ATC':'I', 'ATT':'I', 'ATG':'M',\n",
|
||
|
" 'ACA':'T', 'ACC':'T', 'ACG':'T', 'ACT':'T',\n",
|
||
|
" 'AAC':'N', 'AAT':'N', 'AAA':'K', 'AAG':'K',\n",
|
||
|
" 'AGC':'S', 'AGT':'S', 'AGA':'R', 'AGG':'R',\n",
|
||
|
" 'CTA':'L', 'CTC':'L', 'CTG':'L', 'CTT':'L',\n",
|
||
|
" 'CCA':'P', 'CCC':'P', 'CCG':'P', 'CCT':'P',\n",
|
||
|
" 'CAC':'H', 'CAT':'H', 'CAA':'Q', 'CAG':'Q',\n",
|
||
|
" 'CGA':'R', 'CGC':'R', 'CGG':'R', 'CGT':'R',\n",
|
||
|
" 'GTA':'V', 'GTC':'V', 'GTG':'V', 'GTT':'V',\n",
|
||
|
" 'GCA':'A', 'GCC':'A', 'GCG':'A', 'GCT':'A',\n",
|
||
|
" 'GAC':'D', 'GAT':'D', 'GAA':'E', 'GAG':'E',\n",
|
||
|
" 'GGA':'G', 'GGC':'G', 'GGG':'G', 'GGT':'G',\n",
|
||
|
" 'TCA':'S', 'TCC':'S', 'TCG':'S', 'TCT':'S',\n",
|
||
|
" 'TTC':'F', 'TTT':'F', 'TTA':'L', 'TTG':'L',\n",
|
||
|
" 'TAC':'Y', 'TAT':'Y', 'TAA':'_', 'TAG':'_',\n",
|
||
|
" 'TGC':'C', 'TGT':'C', 'TGA':'_', 'TGG':'W',\n",
|
||
|
" }\n",
|
||
|
"\n",
|
||
|
"def get_triplets(t):\n",
|
||
|
" for triplet in re.finditer(r'.{3}', t):\n",
|
||
|
" yield genetic_code[triplet.group(0)]\n",
|
||
|
"\n",
|
||
|
"rang_freq_with_labels('dna-aminos', get_triplets(dna))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### „Zdania” w języku DNA\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Z aminokwasów zakodowanych przez tryplet budowane są białka.\n",
|
||
|
"Maszyneria budująca białka czyta sekwencję aż do napotkania\n",
|
||
|
"trypletu STOP (\\_ powyżej). Taka sekwencja to *gen*.\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAA0B0lEQVR4nO3df3RU9Z3/8deU/DBkk1sCZIZZI6ZuSsFEV0M3JP0BKxBgjanHHsGGneKRAhaFzgrLj3W7RU+bAN2Cu83WokuFIm56vucYt6fQlLDVVDYE0mhaiEDpMfKjZBLqTiZB00kM9/uHh1smiYAKzEw+z8c59xzmc9/3zuc9dzAvP5k7uGzbtgUAAABjfCLaEwAAAMD1RQAEAAAwDAEQAADAMARAAAAAwxAAAQAADEMABAAAMAwBEAAAwDAEQAAAAMMQAAEAAAxDAAQAADAMARAAAMAwBEAAAADDEAABAAAMQwAEAAAwDAEQAADAMARAAAAAwxAAAQAADEMABAAAMAwBEAAAwDAEQAAAAMMQAAEAAAxDAAQAADAMARAAAMAwBEAAAADDEAABAAAMQwAEAAAwDAEQAADAMARAAAAAwxAAAQAADEMABAAAMAwBEAAAwDAEQAAAAMMQAAEAAAxDAAQAADAMARAAAMAwBEAAAAD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p2rZtm0aMGOHU7Ny5U8uXL3fuFi4tLVVlZeW1bw4AACDKYv57AGMZ3wMIAED84XsAY/gzgAAAALg2CIAAAACGIQACAAAYhgAIAABgGAI
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"def get_genes(triplets):\n",
|
||
|
" gene = []\n",
|
||
|
" for ammino in triplets:\n",
|
||
|
" if ammino == '_':\n",
|
||
|
" yield gene\n",
|
||
|
" gene = []\n",
|
||
|
" else:\n",
|
||
|
" gene.append(ammino)\n",
|
||
|
"\n",
|
||
|
"plt.figure().clear()\n",
|
||
|
"plt.hist([len(g) for g in get_genes(get_triplets(dna))], bins=100)\n",
|
||
|
"\n",
|
||
|
"fname = '03_Ngramy/dna_length.png'\n",
|
||
|
"\n",
|
||
|
"plt.savefig(fname)\n",
|
||
|
"\n",
|
||
|
"fname"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3 (ipykernel)",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.10.9"
|
||
|
},
|
||
|
"org": null
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 1
|
||
|
}
|