{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Getting started\n", "\n", "It is assumed that you have read\n", "[start](start.ipynb)\n", "and followed the installation instructions there." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Corpus\n", "\n", "This is\n", "\n", "* `quran` Q'uran" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# First acquaintance\n", "\n", "We just want to grasp what the corpus is about and how we can find our way in the data.\n", "\n", "Open a terminal or command prompt and say one of the following\n", "\n", "```text-fabric quran```\n", "\n", "Wait and see a lot happening before your browser starts up and shows you an interface on the corpus:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Text-Fabric needs an app to deal with the corpus-specific things.\n", "It downloads/finds/caches the latest version of the **app**:\n", "\n", "```\n", "Using TF-app in /Users/dirk/text-fabric-data/annotation/app-quran/code:\n", "\t#c55d75da760bfdc6ae272b3ade9629fe34d059ce (latest commit)\n", "```\n", "\n", "It downloads/finds/caches the latest version of the **data**:\n", "\n", "```\n", "Using data in /Users/dirk/text-fabric-data/q-ran/quran/tf/0.4:\n", "\trv0.5=#60bd6788dadb13974e89df55cde7687c0593e65f (latest release)\n", "```\n", "\n", "The data is preprocessed in order to speed up typical Text-Fabric operations.\n", "The result is cached on your computer.\n", "Preprocessing costs time. Next time you use this corpus on this machine, the startup time is much quicker.\n", "\n", "```\n", "TF setup done.\n", "```\n", "\n", "Then the app goes on to act as a local webserver serving the corpus that has just been downloaded\n", "and it will open your browser for you and load the corpus page\n", "\n", "```\n", " * Running on http://localhost:8105/ (Press CTRL+C to quit)\n", "Opening quran in browser\n", "Listening at port 18985\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Help!\n", "\n", "Indeed, that is what you need. Click the vertical `Help` tab.\n", "\n", "From there, click around a little bit. Don't read closely, just note the kinds of information that is presented to you.\n", "\n", "Later on, it will make more sense!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Browsing\n", "\n", "First we browse our data. Click the browse button.\n", "\n", "\n", "\n", "and then, in the table of *documents* (suras), click on one.\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now you're looking at the ayas of a sura: the marks in an Arabic unicode characters.\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now click the *Options* tab and select the `text-trans-full` format to see the sura tablet in ascii transcription.\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can click a triangle to see how a line is broken down:\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Searching\n", "\n", "An aya is a verse in a sura.\n", "Let's find all the ayas that contain a verb followed by the word for Allah.\n", "\n", "Enter this query in the search pad and press the search icon above it.\n", "\n", "```\n", "aya\n", " word pos=verb\n", " <: word pos=noun\n", " posx=proper\n", " root=Alh\n", "```\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In English:\n", "\n", "search all `aya`s that contain a `word` and a `word` where:\n", "\n", "* `<:` the second `word` follows immediately on the first `word`\n", "* the first `word` has value `verb` for feature `pos` (part-of-speech)\n", "* the second `word` has\n", " * value `noun` for feature `pos`\n", " * value `proper` for feature `posx` (subcategorisation of part-of-speech)\n", " * value `Alh` for feature `root` (basic word form, more fundamental than lemma)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can expand results by clicking the triangle.\n", "\n", "You can see the result in context by clicking the browse icon.\n", "\n", "You can go back to the result list by clicking the results icon.\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This corpus has a feature for ayas in which an English translation is given: `translation@en`.\n", "\n", "We can trigger the display of these translations by mentioning the feature in the query without posing additional constraints:\n", "\n", "```\n", "aya translation@en*\n", " word pos=verb\n", " <: word pos=noun\n", " posx=proper\n", " root=Alh\n", "```\n", "\n", "The `*` means: any value or even no value.\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Computing\n", "\n", "We have found verbs associated with Allah.\n", "\n", "The question comes to mind: are there verbs that are associated with Allah only in this way?\n", "\n", "Let us look for verbs, followed by nouns, and for each verb, count how many different nouns occur in that position.\n", "\n", "*This is a typical question where you want to leave the search mode and enter computing mode*.\n", "\n", "Let's do that!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you have followed the installation instructions, you are set.\n", "Go to the browser window that opened when you gave the command `jupyter notebook` in your terminal.\n", "\n", "Then continue reading, and, ... executing.\n", "\n", "You can execute a cell by putting your cursor inside it and pressing `Shift Enter`." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First we load the Text-Fabric module, as follows:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import collections\n", "import seaborn as sns\n", "from tf.app import use" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we load the TF-app for the corpus `quran` and that app loads the corpus data.\n", "\n", "We give a name to the result of all that loading: `A`." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "TF-app: ~/github/annotation/app-quran/code" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "data: ~/github/q-ran/quran/tf/0.4" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Text-Fabric: Text-Fabric API 8.3.0, app-quran, Search Reference
Data: QURAN, Character table, Feature docs
Features:
Qurana
ascii
ax
case
component
definite
f
formation
fx
gn
interjection
l
lemma
lx
mood
n
name
name@ll
nameAscii
nameTrans
nu
number
order
otype
pos
posx
ps
root
sp
space
tense
translation@ll
type
unicode
voice
w
wx
oslots
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
Text-Fabric API: names N F E L T S C TF directly usable

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A = use(\"quran:clone\", checkout=\"clone\", hoist=globals())\n", "# A = use('quran', hoist=globals())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Some bits are familiar from above, when you ran the `text-fabric` command in the terminal.\n", "\n", "Other bits are links to the documentation, they point to the same places as the links on the Text-Fabric browser.\n", "\n", "You see a list of all the data features that have been loaded.\n", "\n", "And a list of references to the API documentation, which tells you how you can use this data in your program statements." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Searching (revisited)\n", "\n", "We do the same search again, but now inside our program.\n", "\n", "That means that we can capture the results in a list for further processing." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.34s 529 results\n" ] } ], "source": [ "results = A.search(\n", " \"\"\"\n", "aya\n", " word pos=verb\n", " <: word pos=noun\n", " posx=proper\n", " root=Alh\n", "\"\"\"\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In less than a second, we have all the results!\n", "\n", "Let's look at the first one:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(128233, 131, 132)" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "results[0]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Each result is a list of numbers: for a\n", "\n", "1. aya\n", "1. word\n", "1. word" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here is the second one:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(128243, 341, 342)" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "results[1]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And here the last one:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(134357, 127588, 127589)" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "results[-1]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we modify the query to get all pairs of proper verbs followed by a proper noun." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.30s 2103 results\n" ] } ], "source": [ "results = A.search(\n", " \"\"\"\n", "aya\n", " word pos=verb\n", " <: word pos=noun\n", "\"\"\"\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We are going to make buckets for the root of each verb found, and in those buckets we throw the roots of all nouns found after them.\n", "We also count the number of occurrences of each noun root in the buckets." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "buckets = collections.defaultdict(collections.Counter)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "for (aya, verb, noun) in results:\n", " buckets[F.root.v(verb)][F.root.v(noun)] += 1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "How many buckets do we have?" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "359" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(buckets)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "How many nouns are there in each bucket?" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "min(len(nouns) for (bucket, nouns) in buckets.items())" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "115" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "max(len(nouns) for (bucket, nouns) in buckets.items())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lets get a picture of the distribution." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEJCAYAAACXCJy4AAAABHNCSVQICAgIfAhki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4x//iKioKJw5cwa/+tWvUFlZCcC5bPN7770HpbLnf5Nz585hw4YN+N///V+MGzcO1dXVWLFiBSoqKvDMM89g8+bNKCsr67Xe8+fP480334TZbMbChQvxxRdfQBCEPq/nSW/XUyqV+OKLL7B//37IZDL8/ve/x+nTpzFz5kyP16OrGwOf/MK1116Lm266CQBw8803o6SkZEDn3XnnnQCAcePGITY2FnFxcQCA6667Dq2tra7jlixZAsC5lEZycjKqq6uhUChgMBiwbNky13EymQznz58HAMyYMcMt7AHgs88+Q1JSEsaNGwcAroXUvvrqK48rG86dOxdyuRwajQbXX389Wltbce7cuT6v50lv15s1axYUCgXuvfdeJCcnIy0tze+XC6GRwcAnv3D50Mfly9z+dMlbm83W47ygoCDXv1UqVZ/Xl8t/nJ8giiKUSiXsdjtmzZqF7du3u9rq6+uh1Wpx4MABqNXqXq/V2yioKIro6urqtwag9/vs73qe7r+360VERKCsrAzHjh3DZ599hscffxy5ubk9XthImjhLh/xaVFSUq6fb1NTUYynrwej+iaGurg5VVVWYNWsWkpKScPjwYZw7dw4A8MknnyA7OxtWq7Xfa3Wf99133wEAqqurUV9fj+nTpw+ptv6uFxUVhb/97W8QRRFmsxmHDh3yeL2PPvoIy5Ytw6233oqVK1firrvuwqlTp4ZUG11d2MMnv/bAAw9g9erVSEtLw9ixY3H77bcP6TpWqxV33303bDYb1q9fjwkTJgAANm3ahH//93939fp37drVZ8++28SJE7Fhwwb89re/hd1uR0hICP7rv/4L4eHhQ6qtv+tlZ2fj008/xZ133gmdTodbb721158ILpeSkoK//OUvyMzMhFqtxqhRo7B58+Yh1UZXF87SISKSCA7pEBFJBAOfiEgiGPhERBLBwCcikggGPhGRRDDwiYgkgoFPRCQRDHwiIon4/3G0z7f05XzWAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "sns.set(color_codes=True)\n", "sns.distplot(list(len(nouns) for nouns in buckets.values()), axlabel=\"number of nouns\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We collect the buckets of length 1 in two sets: those with Allah in the bucket and those with another word:" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "with Alh: 39\n", "without Alh: 163\n" ] } ], "source": [ "buckets1A = {\n", " bucket for (bucket, nouns) in buckets.items() if len(nouns) == 1 and \"Alh\" in nouns\n", "}\n", "buckets1N = {\n", " bucket\n", " for (bucket, nouns) in buckets.items()\n", " if len(nouns) == 1 and \"Alh\" not in nouns\n", "}\n", "print(f\"with Alh: {len(buckets1A):>3}\")\n", "print(f\"without Alh: {len(buckets1N):>3}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally we show the roots of the verbs that are associated only with `Alh`:" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['$qq',\n", " 'Axr',\n", " 'Edd',\n", " 'Efw',\n", " 'Ehd',\n", " 'Ejl',\n", " 'Ejz',\n", " 'Hdd',\n", " 'Hrb',\n", " 'HwT',\n", " 'Hyf',\n", " 'Sdq',\n", " 'TbE',\n", " 'bsT',\n", " 'frD',\n", " 'fsH',\n", " 'gDb',\n", " 'hwn',\n", " 'jdl',\n", " 'kfy',\n", " 'krh',\n", " 'mHS',\n", " 'mHn',\n", " 'mHq',\n", " 'mHw',\n", " 'mkr',\n", " 'mnn',\n", " 'myz',\n", " 'nqm',\n", " 'nsx',\n", " 'qrD',\n", " 'rDw',\n", " 'sxT',\n", " 'twb',\n", " 'wfq',\n", " 'wld',\n", " 'xsf',\n", " 'xtm',\n", " 'xzy']" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sorted(buckets1A)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And now we want to find them back in the text and show the translations of the ayas they contain.\n", "\n", "We compute a query out of the `bucket1A` contents, and run it." ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Ejz|xsf|Hrb|frD|xtm|mHq|rDw|nsx|wld|$qq|Hdd|mHw|Hyf|bsT|TbE|fsH|jdl|Ejl|sxT|wfq|mHn|mHS|qrD|Efw|Edd|hwn|Axr|twb|nqm|gDb|Ehd|mkr|krh|mnn|xzy|HwT|Sdq|kfy|myz'" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "condition = \"|\".join(buckets1A)\n", "condition" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "query = f\"\"\"\n", "aya\n", " word pos=verb\n", " root={condition}\n", " <: word pos=noun\n", "\"\"\"" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "aya\n", " word pos=verb\n", " root=Ejz|xsf|Hrb|frD|xtm|mHq|rDw|nsx|wld|$qq|Hdd|mHw|Hyf|bsT|TbE|fsH|jdl|Ejl|sxT|wfq|mHn|mHS|qrD|Efw|Edd|hwn|Axr|twb|nqm|gDb|Ehd|mkr|krh|mnn|xzy|HwT|Sdq|kfy|myz\n", " <: word pos=noun \n", "\n" ] } ], "source": [ "print(query)" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.29s 78 results\n" ] } ], "source": [ "results = A.search(query)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we can show the results quite easily:" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
npayawordword
12:7
خَتَمَ ٱللَّهُ عَلَىٰ قُلُوبِهِمْ وَعَلَىٰ سَمْعِهِمْ وَعَلَىٰٓ أَبْصَٰرِهِمْ غِشَٰوَةٌ وَلَهُمْ عَذَابٌ عَظِيمٌ
خَتَمَ
ٱللَّهُ
22:245
مَّن ذَا ٱلَّذِى يُقْرِضُ ٱللَّهَ قَرْضًا حَسَنًا فَيُضَٰعِفَهُۥ لَهُۥٓ أَضْعَافًا كَثِيرَةً وَٱللَّهُ يَقْبِضُ وَيَبْصُۜطُ وَإِلَيْهِ تُرْجَعُونَ
يُقْرِضُ
ٱللَّهَ
32:276
يَمْحَقُ ٱللَّهُ ٱلرِّبَوٰا۟ وَيُرْبِى ٱلصَّدَقَٰتِ وَٱللَّهُ لَا يُحِبُّ كُلَّ كَفَّارٍ أَثِيمٍ
يَمْحَقُ
ٱللَّهُ
43:54
وَمَكَرُوا۟ وَمَكَرَ ٱللَّهُ وَٱللَّهُ خَيْرُ ٱلْمَٰكِرِينَ
مَكَرَ
ٱللَّهُ
53:95
قُلْ صَدَقَ ٱللَّهُ فَٱتَّبِعُوا۟ مِلَّةَ إِبْرَٰهِيمَ حَنِيفًا وَمَا كَانَ مِنَ ٱلْمُشْرِكِينَ
صَدَقَ
ٱللَّهُ
63:141
وَلِيُمَحِّصَ ٱللَّهُ ٱلَّذِينَ ءَامَنُوا۟ وَيَمْحَقَ ٱلْكَٰفِرِينَ
يُمَحِّصَ
ٱللَّهُ
73:155
إِنَّ ٱلَّذِينَ تَوَلَّوْا۟ مِنكُمْ يَوْمَ ٱلْتَقَى ٱلْجَمْعَانِ إِنَّمَا ٱسْتَزَلَّهُمُ ٱلشَّيْطَٰنُ بِبَعْضِ مَا كَسَبُوا۟ وَلَقَدْ عَفَا ٱللَّهُ عَنْهُمْ إِنَّ ٱللَّهَ غَفُورٌ حَلِيمٌ
عَفَا
ٱللَّهُ
83:164
لَقَدْ مَنَّ ٱللَّهُ عَلَى ٱلْمُؤْمِنِينَ إِذْ بَعَثَ فِيهِمْ رَسُولًا مِّنْ أَنفُسِهِمْ يَتْلُوا۟ عَلَيْهِمْ ءَايَٰتِهِۦ وَيُزَكِّيهِمْ وَيُعَلِّمُهُمُ ٱلْكِتَٰبَ وَٱلْحِكْمَةَ وَإِن كَانُوا۟ مِن قَبْلُ لَفِى ضَلَٰلٍ مُّبِينٍ
مَنَّ
ٱللَّهُ
94:17
إِنَّمَا ٱلتَّوْبَةُ عَلَى ٱللَّهِ لِلَّذِينَ يَعْمَلُونَ ٱلسُّوٓءَ بِجَهَٰلَةٍ ثُمَّ يَتُوبُونَ مِن قَرِيبٍ فَأُو۟لَٰٓئِكَ يَتُوبُ ٱللَّهُ عَلَيْهِمْ وَكَانَ ٱللَّهُ عَلِيمًا حَكِيمًا
يَتُوبُ
ٱللَّهُ
104:35
وَإِنْ خِفْتُمْ شِقَاقَ بَيْنِهِمَا فَٱبْعَثُوا۟ حَكَمًا مِّنْ أَهْلِهِۦ وَحَكَمًا مِّنْ أَهْلِهَآ إِن يُرِيدَآ إِصْلَٰحًا يُوَفِّقِ ٱللَّهُ بَيْنَهُمَآ إِنَّ ٱللَّهَ كَانَ عَلِيمًا خَبِيرًا
يُوَفِّقِ
ٱللَّهُ
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.table(results, end=10)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We check the results in transcription" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
npayawordword
12:7
xatama {ll~ahu EalaY` quluwbihimo waEalaY` samoEihimo waEalaY`^ >aboSa`rihimo gi$a`wapN walahumo Ea*aAbN EaZiymN
xatama
{ll~ahu
22:245
m~an *aA {l~a*iY yuqoriDu {ll~aha qaroDFA HasanFA fayuDa`Eifahu, lahu,^ >aDoEaAfFA kaviyrapF wa{ll~ahu yaqobiDu wayaboS:uTu wa<ilayohi turojaEuwna
yuqoriDu
{ll~aha
32:276
yamoHaqu {ll~ahu {lr~ibaw`A@ wayurobiY {lS~adaqa`ti wa{ll~ahu laA yuHib~u kul~a kaf~aArK >aviymK
yamoHaqu
{ll~ahu
43:54
wamakaruwA@ wamakara {ll~ahu wa{ll~ahu xayoru {loma`kiriyna
makara
{ll~ahu
53:95
qulo Sadaqa {ll~ahu fa{t~abiEuwA@ mil~apa <ibora`hiyma HaniyfFA wamaA kaAna mina {lomu$orikiyna
Sadaqa
{ll~ahu
63:141
waliyumaH~iSa {ll~ahu {l~a*iyna 'aAmanuwA@ wayamoHaqa {loka`firiyna
yumaH~iSa
{ll~ahu
73:155
<in~a {l~a*iyna tawal~awoA@ minkumo yawoma {lotaqaY {lojamoEaAni <in~amaA {sotazal~ahumu {l$~ayoTa`nu bibaEoDi maA kasabuwA@ walaqado EafaA {ll~ahu Eanohumo <in~a {ll~aha gafuwrN HaliymN
EafaA
{ll~ahu
83:164
laqado man~a {ll~ahu EalaY {lomu&ominiyna <i*o baEava fiyhimo rasuwlFA m~ino >anfusihimo yatoluwA@ Ealayohimo 'aAya`tihi. wayuzak~iyhimo wayuEal~imuhumu {lokita`ba wa{loHikomapa wa<in kaAnuwA@ min qabolu lafiY Dala`lK m~ubiynK
man~a
{ll~ahu
94:17
<in~amaA {lt~awobapu EalaY {ll~ahi lil~a*iyna yaEomaluwna {ls~uw^'a bijaha`lapK vum~a yatuwbuwna min qariybK fa>uw@la`^}ika yatuwbu {ll~ahu Ealayohimo wakaAna {ll~ahu EaliymFA HakiymFA
yatuwbu
{ll~ahu
104:35
wa<ino xifotumo $iqaAqa bayonihimaA fa{boEavuwA@ HakamFA m~ino >aholihi. waHakamFA m~ino >aholihaA^ <in yuriydaA^ <iSola`HFA yuwaf~iqi {ll~ahu bayonahumaA^ <in~a {ll~aha kaAna EaliymFA xabiyrFA
yuwaf~iqi
{ll~ahu
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.table(results, end=10, fmt=\"text-trans-full\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Even better, we have a transcription that only shows the roots of the words:" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
npayawordword
12:7
xtm Alh qlb smE bSr g$w E*b EZm
xtm
Alh
22:245
qrD Alh qrD Hsn DEf DEf kvr Alh qbD bsT rjE
qrD
Alh
32:276
mHq Alh rbw rbw Sdq Alh Hbb kll kfr Avm
mHq
Alh
43:54
mkr mkr Alh Alh xyr mkr
mkr
Alh
53:95
qwl Sdq Alh tbE mll Hnf kwn $rk
Sdq
Alh
63:141
mHS Alh Amn mHq kfr
mHS
Alh
73:155
wly ywm lqy jmE zll $Tn bED ksb Efw Alh Alh gfr Hlm
Efw
Alh
83:164
mnn Alh Amn bEv rsl nfs tlw Ayy zkw Elm ktb Hkm kwn qbl Dll byn
mnn
Alh
94:17
twb Alh Eml swA jhl twb qrb twb Alh kwn Alh Elm Hkm
twb
Alh
104:35
xwf $qq byn bEv Hkm Ahl Hkm Ahl rwd SlH wfq Alh byn Alh kwn Elm xbr
wfq
Alh
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.table(results, end=10, fmt=\"root-trans-full\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "But we wanted the translations of the relevant ayas. Here they come:" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "God has set a seal on their hearts and on their hearing, and on their eyes is a covering, and there awaits them a mighty chastisement.\n", "-----\n", "Who is he that will lend God a good loan, and He will multiply it for him manifold? God grasps, and outspreads; and unto Him you shall be returned.\n", "-----\n", "God blots out usury, but freewill offerings He augments with interest. God loves not any guilty ingrate.\n", "-----\n", "And they devised, and God devised, and God is the best of devisers.\n", "-----\n", "Say: 'God has spoken the truth; therefore follow the creed of Abraham, a man of pure faith and no idolater.'\n", "-----\n", "and that God may prove the believers, and blot out the unbelievers.\n", "-----\n", "Those of you who turned away the day the two hosts encountered -- Satan made them slip for somewhat they had earned; but God has pardoned them; God is All-forgiving, All-clement.\n", "-----\n", "Truly God was gracious to the believers when He raised up among them a Messenger from themselves, to recite to them His signs and to purify them, and to teach them the Book and the Wisdom, though before they were in manifest error.\n", "-----\n", "God shall turn only towards those who do evil in ignorance, then shortly repent; God will return towards those; God is All-knowing, All-wise.\n", "-----\n", "And if you fear a breach between the two, bring forth an arbiter from his people and from her people an arbiter, if they desire to set things right; God will compose their differences; surely God is All-knowing, All-aware.\n", "-----\n", "And whoso slays a believer wilfully, his recompense is Gehenna, therein dwelling forever, and God will be wroth with him and will curse him, and prepare for him a mighty chastisement.\n", "-----\n", "O believers, when you are journeying in the path of God, be discriminating, and do not say to him who offers you a greeting, 'Thou art not a believer,' seeking the chance goods of the present life. With God are spoils abundant. So you were aforetime; but God has been gracious to you. So be discriminating; surely God is aware of the things you do.\n", "-----\n", "Ha, there you are; you have disputed on their behalf in the present life; but who will dispute with God on their behalf on the Resurrection Day, or who will be a guardian for them?\n", "-----\n", "So, for their breaking the compact, and disbelieving in the signs of God, and slaying the Prophets without right, and for their saying, 'Our hearts are uncircumcised' -- nay, but God sealed them for their unbelief, so they believe not, except a few --\n", "-----\n", "And they supposed there should be no trial; but blind they were, and deaf. Then God turned towards them; then again blind they were, many of them, and deaf; and God sees the things they do.\n", "-----\n", "Thou seest many of them making unbelievers their friends. Evil is that they have forwarded to their account, that God is angered against them, and in the chastisement they shall dwell forever.\n", "-----\n", "O believers, slay not the game while you are in pilgrim sanctity; whosoever of you slays it wilfully, there shall be recompense -- the like of what he has slain, in flocks as shall be judged by two men of equity among you, an offering to reach the Kaaba; or expiation -- food for poor persons or the equivalent of that in fasting, so that he may taste the mischief of his action. God has pardoned what is past; but whoever offends again, God will take vengeance on him, God is All-mighty, Vengeful.\n", "-----\n", "O believers, slay not the game while you are in pilgrim sanctity; whosoever of you slays it wilfully, there shall be recompense -- the like of what he has slain, in flocks as shall be judged by two men of equity among you, an offering to reach the Kaaba; or expiation -- food for poor persons or the equivalent of that in fasting, so that he may taste the mischief of his action. God has pardoned what is past; but whoever offends again, God will take vengeance on him, God is All-mighty, Vengeful.\n", "-----\n", "O believers, question not concerning things which, if they were revealed to you, would vex you; yet if you question concerning them when the Koran is being sent down, they will be revealed to you. God has effaced those things; for God is All-forgiving, All-clement.\n", "-----\n", "God said, 'This is the day the truthful shall be profited by their truthfulness. For them await gardens underneath which rivers flow, therein dwelling forever and ever; God being well-pleased with them and they well-pleased with Him; that is the mighty triumph.'\n", "-----\n", "Even so We have tried some of them by others that they may say, Are these the ones God has been gracious to among us?' Knows not God very well the thankful?\n", "-----\n", "Those cities We relate to thee tidings of; their Messengers came to them with the clear signs, but they were not the ones to believe in that they had cried lies before; so God seals the hearts of the unbelievers.\n", "-----\n", "That, because they had made a breach with God and with His Messenger; and whosoever makes a breach with God and with His Messenger, surely God is terrible in retribution.\n", "-----\n", "And when the unbelievers were devising against thee, to confine thee, or slay thee, or to expel thee, and were devising, and God was devising; and God is the best of devisers.\n", "-----\n", "that God may distinguish the corrupt from the good, and place the corrupt one upon another, and so heap them up all together, and put them in Gehenna; those are the losers.\n", "-----\n", "and He will remove the rage within their hearts; and God turns towards whomsoever He will; God is All-knowing, All-wise\n", "-----\n", "then God thereafter turns towards whom He will; God is All-forgiving, All-compassionate.\n", "-----\n", "God pardon thee! Why gavest thou them leave, till it was clear to thee which of them spoke the truth, and thou knewest the liars?\n", "-----\n", "If they had desired to go forth, they would have made some preparation for it; but God was averse that they should be aroused, so He made them pause, and it was said to them, 'Tarry you with the tarriers.'\n", "-----\n", "Do they not know that whosoever opposes God and His Messenger -- for him awaits the fire of Gehenna, therein to dwell forever? That is the mighty degradation.\n", "-----\n", "And some of them have made covenant with God: 'If He gives us of His bounty, we will make offerings and be of the righteous.'\n", "-----\n", "God has prepared for them gardens underneath which rivers flow, therein to dwell forever; that is the mighty triumph.\n", "-----\n", "The way is open only against those who ask leave of thee, being rich; they are well-pleased to be with those behind; God has set a seal on their hearts, so they know not.\n", "-----\n", "And the Outstrippers, the first of the Emigrants and the Helpers, and those who followed them in good-doing -- God will be well-pleased with them and they are well-pleased with Him; and He has prepared for them gardens underneath which rivers flow, therein to dwell forever and ever; that is the mighty triumph.\n", "-----\n", "And those who have taken a mosque in opposition and unbelief, and to divide the believers, and as a place of ambush for those who fought God and His Messenger aforetime -- they will swear 'We desired nothing but good'; and God testifies they are truly liars.\n", "-----\n", "God has turned towards the Prophet and the Emigrants and the Helpers who followed him in the hour of difficulty, after the hearts of a part of them well-nigh swerved aside; then He turned towards them; surely He is Gentle to them, and All-compassionate.\n", "-----\n", "If God should hasten unto men evil as they would hasten good, their term would be already decided for them. But We leave those, who look not to encounter Us, in their insolence wandering blindly.\n", "-----\n", "They said, 'Why, art thou indeed Joseph?' 'I am Joseph,' he said. 'This is my brother. God has indeed been gracious unto us. Whosoever fears God, and is patient -- surely God leaves not to waste the wage of the good-doers.\n", "-----\n", "God blots out, and He establishes whatsoever He will; and with Him is the Essence of the Book.\n", "-----\n", "Do they feel secure, those who devise evil things, that God will not cause the earth to swallow them, or that the chastisement will not come upon them, from whence they are not aware?\n", "-----\n", "Those -- God has set a seal on their hearts, and their hearing, and their eyes, and those -- they are the heedless ones;\n", "-----\n", "Hast thou not seen how to God bow all who are in the and all who are in the earth, heavens the sun and the moon, the stars and the mountains, the trees and the beasts, and many of mankind? And many merit the chastisement; and whom God abases, there is none to honour him. God does whatsoever He will.\n", "-----\n", "We sent not ever any Messenger or Prophet before thee, but that Satan cast into his fancy, when he was fancying; but God annuls what Satan casts, then God confirms His signs -- surely God is All-knowing, All-wise --\n", "-----\n", "What, is there sickness in their hearts, or are they in doubt, or do they fear that God may be unjust towards them and His Messenger? Nay, but those -- they are the evildoers.\n", "-----\n", "and in the morning those who had longed to be in his place the day before were saying, 'Ah, God outspreads and straitens His provision to whomsoever He will of His servants. Had God not been gracious to us, He would have made us to be swallowed too. Ah, the unbelievers do not prosper,\n", "-----\n", "Even so God seals the hearts of those that know not.\n", "-----\n", "When the believers saw the Confederates they said, 'This is what God and His Messenger promised us, and God and His Messenger have spoken truly.' And it only increased them in faith and surrender.\n", "-----\n", "And God sent back those that were unbelievers in their rage, and they attained no good; God spared the believers of fighting. Surely God is All-strong, All-mighty.\n", "-----\n", "Men and women who have surrendered, believing men and believing women, obedient men and obedient women, truthful men and truthful women, enduring men and enduring women, humble men and humble women, men and women who give in charity, men who fast and women who fast, men and women who guard their private parts, men and women who remember God oft -- for them God has prepared forgiveness and a mighty wage.\n", "-----\n", "There is no fault in the Prophet, touching what God has ordained for him -- God's wont with those who passed away before; and God's commandment is doom decreed;\n", "-----\n", "That God may chastise the hypocrites, men and women alike, and the idolaters, men and women alike; and that God may turn again unto the believers, men and women alike. God is All-forgiving, All-compassionate.\n", "-----\n", "'God has begotten?' They are truly liars.\n", "-----\n", "(Those who dispute concerning the signs of God, without any authority come to them, very hateful is that in the sight of God and the believers; 'so God sets a seal on every heart proud', arrogant.)\n", "-----\n", "Or do they say, 'He has forged against God a lie?' But if God wills, He will set a seal on thy heart; and God blots out falsehood and verifies the truth by His words; He knows the thoughts within the breasts.\n", "-----\n", "Had God expanded His provision to His servants, they would have been insolent in the earth; but He sends down in measure whatsoever He will; surely He is aware of and sees His servants.\n", "-----\n", "And some of them there are give ear to thee, till, when they go forth from thee, they say to those who have been given knowledge, 'What said he just now?' Those are they upon whose hearts God has set a seal, and they have followed their caprices.\n", "-----\n", "That is because they have followed what angers God, and have been averse to His good pleasure, so He has made their works to fail.\n", "-----\n", "and that He may chastise the hypocrites, men and women alike, and the idolaters men and women alike, and those who think evil thoughts of God; against them shall be the evil turn of fortune. God is wroth with them, and has cursed them, and has prepared for them Gehenna -- an evil homecoming!\n", "-----\n", "God was well pleased with the believers when they were swearing fealty to thee under the tree, and He knew what was in their hearts, so He sent down the Shechina upon them, and rewarded them with a nigh victory\n", "-----\n", "and other spoils you were not able to take; God had encompassed them already. God is powerful over everything.\n", "-----\n", "God has indeed fulfilled the vision He vouchsafed to His Messenger truly: 'You shall enter the Holy Mosque, if God wills, in security, your heads shaved, your hair cut short, not fearing.' He knew what you knew not, and appointed ere that a nigh victory.\n", "-----\n", "Surely those who lower their voices in the presence of God's Messenger, those are they whose hearts God has tested for godfearing; they shall have forgiveness and a mighty wage.\n", "-----\n", "and God was gracious to us, and guarded us against the chastisement of the burning wind;\n", "-----\n", "Who is he that will lend to God a good loan, and He will multiply it for him, and his shall be a generous wage?\n", "-----\n", "O believers, when it is said to you 'Make room in the assemblies', then make room, and God will make room for you; and when it is said, 'Move up', move up, and God will raise up in rank those of you who believe and have been given knowledge. And God is aware of the things you do.\n", "-----\n", "Are you afraid, before your conspiring, to advance freewill offerings? If you do not so, and God turns again unto you, then perform the prayer, and pay the alms, and obey God and His Messenger. God is aware of the things you do.\n", "-----\n", "Hast thou not regarded those who have taken for friends a people against whom God is wrathful? They belong neither to you nor to them; and they swear upon falsehood, and that wittingly.\n", "-----\n", "God has made ready for them a chastisement terrible; surely they -- evil are the things they have been doing.\n", "-----\n", "Thou shalt not find any people who believe in God and the Last Day who are loving to anyone who opposes. God and His Messenger, not though they were their fathers, or their sons, or their brothers, or their clan. Those -- He has written faith upon their hearts, and He has confirmed them with a Spirit from Himself; and He shall admit them into gardens underneath which rivers flow, therein to dwell forever, God being well-pleased with them, and they well-pleased with Him. Those are God's party; why, surely God's party -- they are the prosperers.\n", "-----\n", "Thou shalt not find any people who believe in God and the Last Day who are loving to anyone who opposes. God and His Messenger, not though they were their fathers, or their sons, or their brothers, or their clan. Those -- He has written faith upon their hearts, and He has confirmed them with a Spirit from Himself; and He shall admit them into gardens underneath which rivers flow, therein to dwell forever, God being well-pleased with them, and they well-pleased with Him. Those are God's party; why, surely God's party -- they are the prosperers.\n", "-----\n", "That is because they made a breach with God and His Messenger; and whosoever makes a breach with God, God is terrible in retribution.\n", "-----\n", "O believers, take not for friends a people against whom God is wrathful, and who have despaired of the world to come, even as the unbelievers have despaired of the inhabitants of the tombs.\n", "-----\n", "But God will never defer any soul when its term comes. And God is aware of the things you do.\n", "-----\n", "God prepared for them a terrible chastisement. So fear God, O men possessed of minds! Believers, God has sent down to you, for a remembrance,\n", "-----\n", "God has ordained for you the absolution of your oaths. God is your Protector, and He is the All-knowing, the All-wise.\n", "-----\n", "Believers, turn to God in sincere repentance; it may be that your Lord will acquit you of your evil deeds, and will admit you into gardens underneath which rivers flow. Upon the day when God will not degrade the Prophet and those who believe with him, their light running before them, and on their right hands; and they say, 'Our 'Lord, perfect for us our light, and forgive us; surely Thou art powerful over everything.'\n", "-----\n", "Indeed, we thought that we should never be able to frustrate God in the earth, neither be able to frustrate Him by flight.\n", "-----\n", "their recompense is with their Lord-Gardens of Eden, underneath which rivers flow, therein dwelling for ever and ever. God is well-pleased with them, and they are well-pleased with Him; that is for him who fears his Lord.\n", "-----\n" ] } ], "source": [ "for (aya, verb, noun) in results:\n", " print(Fs(\"translation@en\").v(aya))\n", " print(\"-----\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.7" } }, "nbformat": 4, "nbformat_minor": 4 }