{ "cells": [ { "cell_type": "markdown", "metadata": { "tags": [] }, "source": [ "# Use Text-Fabric\n", "\n", "Text-Fabric is a rich API.\n", "\n", "It might pay off to look at tutorials for\n", "[various different corpora in TF](https://annotation.github.io/text-fabric/tf/about/corpora.html).\n", "\n", "Or see this one for [Fusus (Lakhnawi)](https://nbviewer.org/github/annotation/tutorials/blob/master/fususl/start.ipynb)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from tf.app import use" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "TF-app: ~/github/annotation/app-fususl/code" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "The requested data is not available offline\n", "\t~/text-fabric-data/among/fusus/tf/Lakhnawi not found\n", "rate limit is 5000 requests per hour, with 5000 left for this hour\n", "\tconnecting to online GitHub repo among/fusus ... connected\n", "\tdownloading https://github.com/among/fusus/releases/download/v0.5/tf-Lakhnawi-0.5.zip ... \n", "\tunzipping ... \n", "\tsaving data\n" ] }, { "data": { "text/html": [ "data: ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "This is Text-Fabric 9.1.1\n", "Api reference : https://annotation.github.io/text-fabric/tf/cheatsheet.html\n", "\n", "18 features found and 0 ignored\n", " | 0.03s T otype from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.22s T oslots from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.12s T lettersp from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.10s T punca from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.10s T punc from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.13s T letters from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.02s T n from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.13s T letterst from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.13s T lettersn from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.01s T ln from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | | 0.01s C __levels__ from otype, oslots, otext\n", " | | 0.56s C __order__ from otype, oslots, __levels__\n", " | | 0.03s C __rank__ from otype, __order__\n", " | | 0.59s C __levUp__ from otype, oslots, __rank__\n", " | | 0.07s C __levDown__ from otype, __levUp__, __rank__\n", " | | 0.19s C __boundary__ from otype, oslots, __rank__\n", " | | 0.02s C __sections__ from otype, oslots, otext, __levUp__, __levels__, n, n, ln\n", " | 0.12s T boxb from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.11s T boxl from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.11s T boxr from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.11s T boxt from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.01s T dir from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.00s T np from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n", " | 0.00s T title from ~/text-fabric-data/among/fusus/tf/Lakhnawi/0.5\n" ] }, { "data": { "text/html": [ "Text-Fabric: Text-Fabric API 9.1.1, app-fususl v3, Search Reference
Data: FUSUS, Character table, Feature docs
Features:
Fusus Al Hikam, by Ibn Arabi, edition Lakhnawiboxb
boxl
boxr
boxt
dir
letters
lettersn
lettersp
letterst
ln
n
np
otype
punc
punca
title
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(\"among/fususl:clone\", hoist=globals())" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "('piece', 'page', 'sentence', 'line', 'column', 'span', 'word')" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "F.otype.all" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "57138" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "F.otype.maxSlot" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Show the pieces" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.00s 33 results\n" ] }, { "data": { "text/html": [ "

result 1

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 1
n=1title=front
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 2

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 2
n=2title=عنوان كتاب فصوص الحكم وخصوص الكلم
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 3

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 3
n=3title=خطبة كتاب فصوص الحكم وخصوص الكلم
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 4

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 4
n=4np=1title=فصّ حكمة إلٰهيّة في كلمة آدميّة.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 5

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 5
n=5np=2title=فصّ حكمة نَفْثِيَّة في كلمة شِـيثِيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 6

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 6
n=6np=3title=فصّ حكمة سُـبُّوحِيّة في كلمة نوحيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 7

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 7
n=7np=4title=فصّ حكمة قُدُّوسِيّة في كلمة إدريسيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 8

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 8
n=8np=5title=فصّ حكمة مُهَيْمِيّة في كلمة إبـراهيميّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 9

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 9
n=9np=6title=فصّ حكمة حَقِـيّة في كلمة إسحاقـيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 10

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 10
n=10title= [٧]فصّ حكمة عَلِيَّة في كلمة إسماعيلـيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 11

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 11
n=11title= [٨]فصّ حكمة رُوحيّة في كلمة يعقوبـيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 12

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 13
n=13title= [٠١] فصّ حكمة أحديّة في كلمة هوديّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 13

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 14
n=14title= [١١] فصّ حكمة فاتحيّة في كلمة صالحيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 14

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 15
n=15title= [٢١] فصّ حكمة قـلبـيّة في كلمة شعيبيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 15

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 16
n=16title= [٣١] فصّ حكمة مَلَـكِيّة في كلمة لوطيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 16

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 17
n=17title= [٤١] فصّ حكمة قَدَرِيّة في كلمة عُـزيريّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 17

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 18
n=18title= [٥١] فصّ حكمة نبويّة في كلمة عيسويّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 18

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 19
n=19title= [٦١] فصّ حكمة رحمانيّة في كلمة سليمانيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 19

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 20
n=20title= [٧١] فصّ حكمة وجوديّة في كلمة داوديّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 20

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 21
n=21title= [٨١] فصّ حكمة نَفْسِيّة في كلمة يونسيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 21

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 22
n=22title= [٩١] فصّ حكمة غيبيّة في كلمة أيّوبيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 22

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 23
n=23title= [٠٢] فصّ حكمة جلاليّة في كلمة يَحْـيَوِيَّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 23

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 24
n=24title= [١٢] فصّ حكمة ما لكيّة في كلمة زكـريّاويّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 24

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 25
n=25title= [٢٢] فصّ حكمة إيـناسيّة في كلمة إلياسيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 25

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 26
n=26title= [٣٢] فصّ حكمة إحسانيّة في كلمة لقمانيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 26

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 27
n=27title= [٤٢] فصّ حكمة إماميّة في كلمة هارونيّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 27

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 28
n=28title= [٥٢] فصّ حكمة عُـلـويّة في كلمة موسويّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 28

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 30
n=30title= [٧٢] فصّ حكمة فرديّة في كلمة محمديّة
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 29

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 34
n=34title= الملحقات
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 30

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 35
n=35title= ملحق ١: تعليقات داخل المخطوط
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 31

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 36
n=36title= ملحق ٢: تحقيق في مسألة الذبيح
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 32

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 37
n=37title= ملحق ٣: تحقيق في خالد بن سنان
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

result 33

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
piece 38
n=38title= ملحق ٤: تخريج حديث التحول
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "results = A.search(\"\"\"\n", "piece n* np* title*\n", "\"\"\")\n", "A.show(results)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[(63039,),\n", " (63040,),\n", " (63041,),\n", " (63042,),\n", " (63043,),\n", " (63044,),\n", " (63045,),\n", " (63046,),\n", " (63047,),\n", " (63048,),\n", " (63049,),\n", " (63050,),\n", " (63051,),\n", " (63052,),\n", " (63053,),\n", " (63054,),\n", " (63055,),\n", " (63056,),\n", " (63057,),\n", " (63058,),\n", " (63059,),\n", " (63060,),\n", " (63061,),\n", " (63062,),\n", " (63063,),\n", " (63064,),\n", " (63065,),\n", " (63066,),\n", " (63067,),\n", " (63068,),\n", " (63069,),\n", " (63070,),\n", " (63071,),\n", " (63072,),\n", " (63073,)]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "results" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "All words on the first line of every page" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "template = \"\"\"\n", "line ln=1\n", " word\n", "\"\"\"" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.06s 4852 results\n" ] } ], "source": [ "results = A.search(template)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[(62361, 1),\n", " (62361, 2),\n", " (62371, 27),\n", " (62371, 28),\n", " (62371, 29),\n", " (62374, 33),\n", " (62374, 34),\n", " (62374, 35),\n", " (62374, 36),\n", " (62385, 91)]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "results[0:10]" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
nplineword
11 1:1فصوص
21 1:1الحكم
31 2:1جميع
41 2:1الحقوق
51 2:1محفوظة
61 3:1بِسمِ
71 3:1اللهِ
81 3:1الرَّحْمٰـنِ
91 3:1الرَّحِيمِ
101 4:1الفهرست
111 5:1٩١‐
121 5:1 [
131 5:1٦١]
141 5:1 فصّ
151 5:1حكمة
161 5:1رحمانيّة
171 5:1في
181 5:1كلمة
191 5:1سليمانيّة……………………
201 5:1٢٤٢
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.table(results, end=20)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "All first words of the first line of every page" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.06s 438 results\n" ] }, { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
nplineword
11 1:1فصوص
21 2:1جميع
31 3:1بِسمِ
41 4:1الفهرست
51 5:1٩١‐
62 6:1[
72 7:1[
83 8:1[
93 9:1وَصَلَّىٰ
103 10:1فَقُلْتُ:
113 11:1الرُّوعِ
123 12:1يُنْزَلُ
133 13:1وَمِنَ
144 14:1[
154 15:1جَامِـعٍ
164 16:1فَـكَانَ
174 17:1فَـكَانَتِ
184 18:1وَهٰذَا
194 19:1أَلَا
204 20:1فَإِنَّهُ
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "template = \"\"\"\n", "line ln=1\n", " =: word\n", "\"\"\"\n", "results = A.search(template)\n", "A.table(results, end=20)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "All last words of the first line of every page" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.06s 438 results\n" ] }, { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
nplineword
11 1:1الحكم
21 2:1محفوظة
31 3:1الرَّحِيمِ
41 4:1الفهرست
51 5:1٢٤٢
62 6:1١وجه]
72 7:1١ظهر]
83 8:1المُؤلِّفِ]
93 9:1بِالقِيلِ
103 10:1
113 11:1
123 12:1
133 13:1بِالشَّرْعِ
144 14:1آدَمِيَّةٍ﴾
154 15:1
164 16:1إِلَّا
174 17:1النَّشْأَةِ
184 18:1الإِدْرَاكِ
194 19:1الحَقُّ
204 20:1ْعِيَّةُ
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "template = \"\"\"\n", "line ln=1\n", " := word\n", "\"\"\"\n", "results = A.search(template)\n", "A.table(results, end=20)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "All first words of a piece" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.07s 33 results\n" ] }, { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
nppieceword
11 1:11فصوص
22 6:12[
33 8:13[
44 14:14[
55 32:15[
66 52:16وَهُوَ
77 71:17المَنَازِلِ،
88 84:18كَمَا
99 95:19٣‐
1010 111:110وَلِهٰذَا
1111 121:111إِنَّ
1213 147:113فَأَسْمَاؤُنَا
1314 166:114تُسَمَّىٰ
1415 173:115الأَشْقِيَاءٍِ:
1516 189:116وَلَا
1617 198:117هِي
1718 211:118وَغَيْرِهِ.
1819 242:119هٰذِهِ
1920 262:120وَإذِا
2021 278:121وَمَا
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "template = \"\"\"\n", "piece\n", " =: word\n", "\"\"\"\n", "results = A.search(template)\n", "A.table(results, end=20)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
4 14:1  [١]﴿فَصُّ حِكْمَةٍ إِلٰهِيَّةٍ فِي كَلِمَةٍ آدَمِيَّةٍ﴾
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "ln = A.nodeFromSectionStr(\"4 14:1\")\n", "A.plain(ln)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Pick line 500" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "62860" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "l = F.otype.s(\"line\")[499]\n", "l" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Where is it?" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
5 45:17  أَوْ عَلَىٰ يَدِ «الجَبَّارِ» فَـيَنْظُـرُ فِي المَوْطِنِ وَمَا يَسْتَحِقُّهُ.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.plain(l)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Show structure" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
line
column
span
أَوْ
عَلَىٰ
يَدِ
«
الجَبَّارِ»
فَـيَنْظُـرُ
فِي
المَوْطِنِ
وَمَا
يَسْتَحِقُّهُ.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.pretty(l)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Show more info" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
line
column
n=1
span
n=1
أَوْ
عَلَىٰ
يَدِ
«
الجَبَّارِ»
فَـيَنْظُـرُ
فِي
المَوْطِنِ
وَمَا
يَسْتَحِقُّهُ.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.pretty(l, extraFeatures=\"n\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Locate a specific portion" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.09s 37 results\n" ] }, { "data": { "text/html": [ "

line 1

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
line
column
n=1
span
n=1
ٱعْلَمْ
letters=ٱعْلَمْ
أَنَّ
letters=أَنَّ
العَطَا
letters=العَطَا
يَا
letters=يَا
وَالمِن
letters=وَالمِن
َحَ
letters=َحَ
الظَّاهِـرَةَ
letters=الظَّاهِـرَةَ
فِي
letters=فِي
الكَونِ
letters=الكَونِ
letters=
عَلَىٰ
letters= عَلَىٰ
أَيْدِي
letters=أَيْدِي
الع
letters=الع
ِبَادِ
letters=ِبَادِ
وَعَلَىٰ
letters=وَعَلَىٰ
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line 2

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
line
column
n=1
span
n=1
غَيْرِ
letters=غَيْرِ
أَيْدِيهِمْ
letters=أَيْدِيهِمْ
letters=
عَلَىٰ
letters= عَلَىٰ
قِسْمَيْنِ:
letters=قِسْمَيْنِ
مِنْهَا،
letters= مِنْهَا
مَاتَـكُونُ
letters= مَاتَـكُونُ
عَطَايَا
letters=عَطَايَا
ذَاتِيَّةً
letters=ذَاتِيَّةً
وَعَطَايَا
letters=وَعَطَايَا
أَسْم
letters=أَسْم
َائِيَّةً،
letters=َائِيَّةً
letters=
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line 3

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
line
column
n=1
span
n=1
وَتَتَمَيَّزُ
letters=وَتَتَمَيَّزُ
عِنْدَ
letters=عِنْدَ
أَهْلِ
letters=أَهْلِ
الأَذْوَاقِ.
letters=الأَذْوَاقِ
letters=
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line 4

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
line
column
n=1
span
n=1
كَمَا
letters=كَمَا
أَنَّ
letters=أَنَّ
مِنْهَا
letters=مِنْهَا
مَاتَـكُونُ
letters=مَاتَـكُونُ
عَنْ
letters=عَنْ
سُؤالٍ
letters=سُؤالٍ
فِي
letters=فِي
مُعَـيَّنٍ،
letters=مُعَـيَّنٍ
وَعَنْ
letters= وَعَنْ
سُؤالٍ
letters=سُؤالٍ
غَـيْرِ
letters=غَـيْرِ
مُعَـيَّنٍ.
letters=مُعَـيَّنٍ
letters=
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line 5

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
line
column
n=1
span
n=1
وَمِنْهَا:
letters=وَمِنْهَا
مَالَا
letters= مَالَا
يَكُونُ
letters=يَكُونُ
عَنْ
letters=عَنْ
سُؤالٍ،
letters=سُؤالٍ
سَوَاءٌ
letters= سَوَاءٌ
كَانَتْ
letters=كَانَتْ
الأُعْطِيَةُ
letters=الأُعْطِيَةُ
ذَاتِيَّةً
letters=ذَاتِيَّةً
أَوْ
letters=أَوْ
أَسْمَائِيَّةً.
letters=أَسْمَائِيَّةً
letters=
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line 6

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
line
column
n=1
span
n=1
فَالمُع
letters=فَالمُع
َيَّنُ
letters=َيَّنُ
كَم
letters=كَم
َنْ
letters=َنْ
يَقُولُ:
letters=يَقُولُ
«
letters=
يَا
letters=يَا
رَبِّ
letters=رَبِّ
أَعْط
letters=أَعْط
ِنِي
letters=ِنِي
كَذَ
letters=كَذَ
ا».
letters=ا
فَي
letters=فَي
ُعَـ
letters=ُعَـ
يِّنُ
letters=يِّنُ
أَمْـرًا
letters=أَمْـرًا
مَا،
letters=مَا
لَا
letters= لَا
يَخْطُـ
letters=يَخْطُـ
رُ
letters=رُ
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line 7

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
line
column
n=1
span
n=1
لَهُ
letters=لَهُ
سِوَاهُ.
letters=سِوَاهُ
وَغَيرُ
letters= وَغَيرُ
المُعَيَّنِ
letters=المُعَيَّنِ
كَمَنْ
letters=كَمَنْ
يَق
letters=يَق
ُولُ:
letters=ُولُ
«
letters=
يَا
letters=يَا
رَبِّ
letters=رَبِّ
أَعْطِنِي
letters=أَعْطِنِي
مَاتَعْل
letters=مَاتَعْل
َمُ
letters=َمُ
فِيهِ
letters=فِيهِ
مَصْلَحَتِي»،
letters=مَصْلَحَتِي
letters=
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "template = \"\"\"\n", "piece n=5\n", " =: page\n", " line\n", " word letters~ا\n", "\"\"\"\n", "results = A.search(template)\n", "A.show(results, condensed=True)" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/html": [ "

line 1

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
5 32:2
line
column
n=1
span
n=1
ٱعْلَمْ
text=ٱعْلَمْ
أَن
text=أَن
َّ
text=َّ
العَطَايَا
text=العَطَايَا
وَالمِنَحَ
text=وَالمِنَحَ
الظ
text=الظ
َّاهِـرَةَ
text=َّاهِـرَةَ
فِي
text=فِي
الكَونِ
text=الكَونِ
text=
عَلَىٰ
text=عَلَىٰ
أَيْدِي
text=أَيْدِي
العِبَادِ
text=العِبَادِ
وَعَلَىٰ
text=وَعَلَىٰ
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line 2

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
5 32:3
line
column
n=1
span
n=1
غَيْرِ
text=غَيْرِ
أَيْدِيهِمْ
text=أَيْدِيهِمْ
text=
عَلَىٰ
text=عَلَىٰ
قِسْمَيْنِ:
text=قِسْمَيْنِ
مِنْهَا،
text=مِنْهَا
مَاتَـكُونُ
text=مَاتَـكُونُ
عَطَايَا
text=عَطَايَا
ذَاتِيَّةً
text=ذَاتِيَّةً
وَعَطَايَا
text=وَعَطَايَا
أَسْمَائِيَّةً،
text=أَسْمَائِيَّةً
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line 3

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
5 32:4
line
column
n=1
span
n=1
وَتَتَمَيَّزُ
text=وَتَتَمَيَّزُ
عِنْدَ
text=عِنْدَ
أَهْلِ
text=أَهْلِ
الأَذْوَاقِ.
text=الأَذْوَاقِ
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line 4

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
5 32:5
line
column
n=1
span
n=1
كَمَا
text=كَمَا
أَن
text=أَن
َّ
text=َّ
مِنْهَا
text=مِنْهَا
مَاتَـكُونُ
text=مَاتَـكُونُ
عَنْ
text=عَنْ
سُؤالٍ
text=سُؤالٍ
فِي
text=فِي
مُعَـيَّنٍ،
text=مُعَـيَّنٍ
وَعَنْ
text=وَعَنْ
سُؤالٍ
text=سُؤالٍ
غَـيْرِ
text=غَـيْرِ
مُعَـيَّنٍ.
text=مُعَـيَّنٍ
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line 5

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
5 32:6
line
column
n=1
span
n=1
وَمِنْهَا:
text=وَمِنْهَا
مَالَا
text=مَالَا
يَكُونُ
text=يَكُونُ
عَنْ
text=عَنْ
سُؤالٍ،
text=سُؤالٍ
سَوَاءٌكَانَتْ
text=سَوَاءٌكَانَتْ
الأُعْطِيَةُ
text=الأُعْطِيَةُ
ذَاتِيَّةً
text=ذَاتِيَّةً
أَوْ
text=أَوْ
أَسْمَائِيَّةً.
text=أَسْمَائِيَّةً
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line 6

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
5 32:7
line
column
n=1
span
n=1
فَالمُعَيَّنُ
text=فَالمُعَيَّنُ
كَمَنْ
text=كَمَنْ
يَقُولُ:
text=يَقُولُ
«يَا
text=يَا
رَبِّ
text=رَبِّ
أَعْطِنِي
text=أَعْطِنِي
كَذَا».
text=كَذَا
فَيُعَـيِّنُ
text=فَيُعَـيِّنُ
أَمْـرًا
text=أَمْـرًا
مَا،
text=مَا
لَا
text=لَا
يَخْطُـرُ
text=يَخْطُـرُ
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

line 7

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
5 32:8
line
column
n=1
span
n=1
لَهُ
text=لَهُ
سِوَاهُ.
text=سِوَاهُ
وَغَيرُ
text=وَغَيرُ
المُعَيَّنِ
text=المُعَيَّنِ
كَمَنْ
text=كَمَنْ
يَقُولُ:
text=يَقُولُ
«يَا
text=يَا
رَبِّ
text=رَبِّ
أَعْطِنِي
text=أَعْطِنِي
مَاتَعْلَمُ
text=مَاتَعْلَمُ
فِيهِ
text=فِيهِ
مَصْلَحَتِي»،
text=مَصْلَحَتِي
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "A.show(results, condensed=True, extraFeatures=\"n title\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.9.7" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }