<jupyter_start><jupyter_text>---To get started: consult [start](start.ipynb)--- Search Introduction*Search* in Text-Fabric is a template based way of looking for structural patterns in your dataset.Within Text-Fabric we have the unique possibility to combine the ease of formulating search templates forcomplicated syntactical patterns with the power of programmatically processing the results.This notebook will show you how to get up and running. Easy commandSearch is as simple as saying (just an example)```pythonresults = A.search(template)A.show(results)```See all ins and outs in the[search template docs](https://annotation.github.io/text-fabric/tf/about/searchusage.html).<jupyter_code>%load_ext autoreload
%autoreload 2
from tf.app import use
A = use("quran:clone", checkout="clone", hoist=globals())
# A = use('quran', hoist=globals())<jupyter_output><empty_output><jupyter_text>Basic search commandWe start with the most simple form of issuing a query.Let's look for the words in sura 1.All work involved in searching takes place under the hood.<jupyter_code>query = """
sura number=1|2|3
  aya number<4
    word
"""
results = A.search(query)
A.table(results, end=10)<jupyter_output>0.12s 80 results<jupyter_text>The hyperlinks take us to aya on Tanzil.Note that we can choose start and/or end points in the results list.<jupyter_code>A.table(results, start=8, end=13)<jupyter_output><empty_output><jupyter_text>We can show the results more fully with `show()`.<jupyter_code>A.displaySetup(queryFeatures=False)
A.show(results, start=1, end=3)<jupyter_output><empty_output><jupyter_text>We can show all results condensed by *aya*:<jupyter_code>A.show(results, condensed=True)<jupyter_output><empty_output><jupyter_text>Meaningful queriesLet's turn to a bit more meaningful query:all ayas with a verb immediately followed by the word for Allah.<jupyter_code>query = """
aya
  word pos=verb
  <: word pos=noun posx=proper root=Alh
"""<jupyter_output><empty_output><jupyter_text>We run it with `A.search()`:<jupyter_code>results = A.search(query)
A.table(results, start=10, end=20)<jupyter_output><empty_output><jupyter_text>Here it comes: the `A.show()` function asks you for some limits (it will not show more than 100 at a time), and then it displays them.It lists the results as follows:* a heading showing which result in the sequence of all results this is* an overview of the nodes in the tuple of this result* a display of all verses that have result material, with the places highlighted that  correspond to a node in the result tuple<jupyter_code>A.show(results, start=10, end=14, withNodes=True)<jupyter_output><empty_output><jupyter_text>We can also package the results tuples in other things than ayas, e.g. pages:<jupyter_code>A.show(results, start=12, end=12, withNodes=True, condensed=True, condenseType="page")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09912739965095986, 'fraction_numerical': 0.011518324607329843, 'mean_word_length': 6.663101604278075, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 36, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '46446', 'license': 'MIT', 'n_tokens_mistral': 928, 'n_tokens_neox': 882, 'n_words': 301, 'path': 'quran/search.ipynb', 'repo_name': 'sethbam9/tutorials', 'size': '2865'}