diff --git a/week1/day1.ipynb b/week1/day1.ipynb index 0a3668c..f8b1a9b 100644 --- a/week1/day1.ipynb +++ b/week1/day1.ipynb @@ -90,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "4e2a9393-7767-488e-a8bf-27c12dca35bd", "metadata": {}, "outputs": [], @@ -131,10 +131,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "7b87cadb-d513-4303-baee-a37b6f938e4d", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "API key found and looks good so far!\n" + ] + } + ], "source": [ "# Load environment variables in a file called .env\n", "\n", @@ -155,7 +163,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "019974d9-f3ad-4a8a-b5f9-0a3719aea2d3", "metadata": {}, "outputs": [], @@ -176,10 +184,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "a58394bf-1e45-46af-9bfd-01e24da6f49a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello! Welcome! I'm glad to hear from you. How can I assist you today?\n" + ] + } + ], "source": [ "# To give you a preview -- calling OpenAI with these messages is this easy. Any problems, head over to the Troubleshooting notebook.\n", "\n", @@ -198,7 +214,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "c5e793b2-6775-426a-a139-4848291d0463", "metadata": {}, "outputs": [], @@ -228,14 +244,519 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "2ef960cf-6dc2-4cda-afb3-b38be12f4c97", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Haq Nawaz - Bridging AI & Islamic Scholarship\n", + "☰\n", + "Introduction\n", + "🕌 Imams of Haramain\n", + "Imam Masjid-e-Nabawi\n", + "Imam-e-Kaaba Juhany\n", + "Imam Khalid Al-Ghamidi\n", + "Projects\n", + "ISDP\n", + "Altasreef\n", + "Easy Quran\n", + "Mohaddis\n", + "Tanzeem\n", + "AI & NLP\n", + "Mobile Apps\n", + "The Noble Quran\n", + "Tazkeer Ul Quran\n", + "Seerat Quiz\n", + "وجود باری تعالیٰ اور توحید\n", + "Publications\n", + "Awards\n", + "Brainiac 2018\n", + "NaSCon 2019\n", + "Contact\n", + "Haq Nawaz\n", + "Islamic Scholar\n", + "|\n", + "NLP & AI Specialist\n", + "|\n", + "Islamic Digital Solutions Expert\n", + "About Me\n", + "Get in Touch\n", + "Introduction\n", + "I am\n", + "Haq Nawaz\n", + ", a faculty member at\n", + "Jamia Ashrafia Lahore\n", + ", a\n", + "PhD Scholar in NLP\n", + "at\n", + "COMSATS University Lahore\n", + ", and a\n", + "Data Science Consultant at ILI.DIGITAL AG\n", + ". I specialize in bridging modern artificial intelligence with\n", + " classical Islamic sciences — leading pioneering efforts in\n", + "Islamic software development\n", + ", digitization, and\n", + "AI-powered Qur'anic and Hadith tools\n", + "for education,\n", + " research, and public benefit.\n", + "As one of the earliest contributors to\n", + "Urdu Unicode content digitization\n", + ", my work has\n", + " enabled millions of words from classical texts—including the Qur’an,\n", + " Hadith, and foundational Islamic literature—to become searchable,\n", + " readable, and interactive across platforms. These efforts laid the\n", + " groundwork for major portals such as\n", + "Easy Quran wa Hadees\n", + "and\n", + "Tanzeem Islami Digital Library\n", + ".\n", + "I’ve developed award-winning educational platforms like\n", + "Altasreef\n", + ", which automates Arabic verb conjugations with Urdu translations and\n", + " exam generation, earning 1st Prize at UET Lahore’s Brainiac 2018. At\n", + " NaSCon 2019 (FAST-NUCES), my personal R&D project in\n", + "Quranic NLP annotation\n", + "—involving 5.4+ million\n", + " attribute labels in three languages—was also recognized nationally.\n", + "My mobile applications include the\n", + "The Noble Quran\n", + "and\n", + "آسان ترجمہ قرآن\n", + "apps, presenting the renowned English and Urdu translations and tafsir\n", + " by\n", + "Mufti Taqi Usmani\n", + "for scholars and general readers\n", + " alike. I’ve also developed\n", + "Tazkeer-ul-Quran\n", + ", which offers multilingual Qur’an translations and thematic\n", + " organization for deep reflection; the\n", + "Seerat Quiz\n", + "app, designed to teach Seerah to school-going children through\n", + " interactive learning; and\n", + "وجود باري تعالى اور توحید\n", + ", a digital presentation of Islamic scholarship, continuing my\n", + " mission of\n", + "digitizing authentic Islamic texts\n", + "for the\n", + " digital age.\n", + "Visit of Imam Masjid-e-Nabawi Dr. Salah Al-Budair – August 15, 2024\n", + "During the visit of\n", + "Imam Masjid-e-Nabawi Dr. Salah Al-Budair\n", + "on\n", + "August 15, 2024\n", + ", I had the honor of presenting our\n", + " research and technological contributions in the field of\n", + "Arabic morphology (علم الصرف)\n", + ". We discussed how\n", + " Natural Language Processing (NLP) and AI can simplify classical\n", + " grammar learning for students.\n", + "Your browser does not support the video tag.\n", + "Visit of Imam-e-Kaaba Dr. Sheikh Abdullah Awad Al-Juhany – April 16,\n", + " 2019\n", + "During the visit of\n", + "Imam-e-Kaaba Dr. Sheikh Abdullah Awad Al-Juhany\n", + "on\n", + "April 16, 2019\n", + ", we explored the integration of\n", + " technology in teaching\n", + "classical Arabic\n", + ". Our\n", + " discussion focused on how digital tools and platforms can enhance the\n", + " learning experience, making classical Arabic more accessible to\n", + " students worldwide.\n", + "Your browser does not support the video tag.\n", + "Visit of Imam Khalid Al-Ghamidi – 2015\n", + "During his 2015 visit to\n", + "Jamia Ashrafia\n", + ", I had\n", + " the honor of presenting my work in\n", + "Qur'anic Natural Language Processing (NLP)\n", + "and\n", + "Islamic tools\n", + "to Sheikh Khalid Al-Ghamidi, Imam\n", + " of Masjid Al-Haram. Our discussion highlighted the implementation\n", + " of\n", + "Qur'an morphological tagging\n", + ", emphasizing its role in enhancing students' understanding of\n", + " classical Arabic and deepening their comprehension of the Qur'anic\n", + " text.\n", + "🎓 Education\n", + "PhD Scholar in Computer Science (NLP & AI)\n", + "–\n", + " COMSATS University Lahore\n", + "Graduation in Dars-e-Nizami / Classical Arabic\n", + "–\n", + " Jamia Ashrafia, Lahore\n", + "MS in Computer Science\n", + "– University of Central\n", + " Punjab, Lahore\n", + "Projects & Innovations\n", + "ISDP – Intensive Software Development Program\n", + "– A groundbreaking initiative to empower graduates of Islamic\n", + " Madrasahs with modern computer science and software engineering\n", + " skills.\n", + "Tailored curriculum for scholars with no prior tech background\n", + "Practical training in web development, databases, and Python\n", + "Students build real Islamic apps and digital tools for da'wah\n", + "Promoting the digitization of Islamic knowledge through\n", + " scholar-led innovation\n", + "Graduates have secured positions in reputable software houses\n", + " such as InstaCare and E Web Craft, contributing as mobile\n", + " application and web developers.\n", + "View success stories here\n", + ".\n", + "ISDP reflects my passion for integrating sacred knowledge with\n", + " cutting-edge technology. It aims to equip our ulema with the tools\n", + " to lead in the digital world — not just follow. The success of our\n", + " graduates in the tech industry underscores the program's\n", + " effectiveness in bridging traditional Islamic scholarship with\n", + " modern technological expertise.\n", + "Altasreef\n", + "– An AI-powered Arabic morphology (علم الصرف) learning platform that\n", + " combines linguistic knowledge with NLP techniques to support\n", + " students of classical Arabic grammar.\n", + "Generates full verb conjugations for ماضی معروف، مضارع معروف،\n", + " امر، مجہول، منصوب، مجزوم، and more\n", + "Covers multiple صرف patterns (باب) like باب سمع، باب فتح، باب\n", + " نصر، باب استفعال، باب انفعال etc.\n", + "Offers full interface and output in\n", + "Urdu, English, and Arabic\n", + "Integrates rule-based NLP logic to model triliteral verb roots\n", + " with pattern-based transformations\n", + "Automatically generates\n", + "Urdu translations\n", + "using\n", + " morphology-aware translation patterns\n", + "Includes an\n", + "Online Exam Generator\n", + "to create practice worksheets for students with or without\n", + " answers (ideal for madrassah & school use)\n", + "Exam sheets can be downloaded for offline revision or classroom\n", + " printing\n", + "This project was awarded\n", + "1st Prize at the Brainiac Software Competition 2018\n", + "(UET Lahore) for digitizing Islamic linguistic education. The\n", + " underlying model and linguistic approach were also published as a\n", + " research paper at\n", + "AbjadNLP 2025 (COLING)\n", + ":\n", + "Read the paper\n", + ".\n", + "Easy Quran wa Hadees\n", + "– A groundbreaking initiative and one of the\n", + "first Urdu Unicode-based Quran and Hadith platforms in\n", + " Pakistan\n", + ". As a\n", + "pioneer developer\n", + ", I led the transformation\n", + " of classical Islamic texts into a digital, Unicode-compliant\n", + " format—setting a new benchmark in Islamic digitization.\n", + "Provides the complete Quran with authentic translations in\n", + "Urdu, English, and Arabic\n", + "Includes key Hadith collections like\n", + "Sahih Bukhari\n", + ",\n", + "Muslim\n", + ",\n", + "Abu Dawood\n", + ", and more\n", + "Uses early\n", + "NLP and intelligent indexing techniques\n", + "for\n", + " fast, root-based and keyword search\n", + "Offers advanced filters for Hadith search by narrator, topic, or\n", + " source\n", + "Audio playback support for Quranic recitation and memorization\n", + "Features bookmarking, note-taking, and tagging capabilities\n", + "Fully localized interface supporting\n", + "multilingual access\n", + "(Urdu, English, Arabic)\n", + "This platform played a\n", + "transformative role\n", + "in\n", + " opening digital Islamic access for Urdu-speaking users. Its\n", + " underlying data and architecture have been\n", + "adopted by numerous mobile apps and online platforms\n", + "across Pakistan and globally. Easy Quran wa Hadees stands as a\n", + "milestone in the history of Islamic digitization\n", + ".\n", + "Mohaddis.com\n", + "– A comprehensive Hadith research platform designed for\n", + " Urdu-speaking audiences, offering easy access to authenticated\n", + " Hadith books with cutting-edge digital tools for exploration,\n", + " referencing, and learning.\n", + "Includes\n", + "major Hadith books\n", + ", including Sahih\n", + " Bukhari, Sahih Muslim, Abu Dawood, Tirmidhi, Nasai, Ibn Majah,\n", + " and Muwatta\n", + "Equipped with\n", + "advanced full-text search\n", + "that\n", + " works across Arabic and Urdu translations\n", + "Allows filtering by\n", + "book, subject, chapter, narrator, or Hadith number\n", + "Offers parallel\n", + "Arabic and Urdu rendering\n", + "for\n", + " each Hadith\n", + "Integrated with\n", + "Fiqh-based categorization\n", + "and\n", + " references to facilitate deeper learning and contextual\n", + " understanding\n", + "Continuously updated with\n", + "editorial corrections and scholarly cross-referencing\n", + "Shareable links to every Hadith and the ability to bookmark for\n", + " future research\n", + "Mohaddis.com stands out as a\n", + "reference-grade Hadith resource\n", + "and a key part of\n", + " the modern Islamic digital library in Pakistan. Its combination of\n", + " traditional content and modern UX has made it widely adopted in\n", + " scholarly circles and educational institutes.\n", + "Tanzeem Islami Digital Library\n", + "– A pioneering content digitization project that transformed\n", + " classical Islamic literature—originally authored in Urdu and typeset\n", + " in InPage—into modern, searchable Unicode format. This initiative\n", + " laid the foundation for preserving Islamic scholarship through\n", + " technology.\n", + "Digitized and indexed a vast collection of books by\n", + "Islami thinkers, scholars, and reformers\n", + "Utilized early\n", + "InPage-to-Unicode conversion pipelines\n", + "to make\n", + " printed books digitally searchable\n", + "Enables\n", + "full-text search\n", + "across books by\n", + " keyword, topic, author, or chapter\n", + "Supported by\n", + "backend NLP tools\n", + "for content\n", + " tagging and semantic classification\n", + "Offers both web-based browsing and categorized downloadable\n", + " content (PDF + Unicode HTML)\n", + "Public access to rare Islamic literature previously locked in\n", + " print archives\n", + "As one of the\n", + "first major Urdu digitization efforts for Islamic books in\n", + " Pakistan\n", + ", this project set a trend in religious archiving and inspired\n", + " many modern Islamic libraries and apps. The platform is now\n", + " referenced by scholars, students, and researchers worldwide.\n", + "Advancing AI, NLP & LLM Solutions\n", + "I lead the development of intelligent language systems powered by\n", + "Large Language Models (LLMs)\n", + "and advanced retrieval mechanisms, applying state-of-the-art AI research to real-world applications.\n", + "Large Language Model (LLM) Solutions\n", + "Fine-tuned GPT-based models for text summarization, generation, and multi-turn conversations\n", + "Implemented Named Entity Recognition (NER), classification, and topic modeling using transformer architectures\n", + "Designed\n", + "zero-shot and few-shot learning pipelines\n", + "to support under-resourced languages like Arabic and Urdu\n", + "Retrieval-Augmented Generation (RAG) & Vector-Based Search\n", + "Built modular RAG systems combining retrieval pipelines with LLMs to deliver accurate, real-time responses\n", + "Integrated\n", + "vector databases\n", + "for semantic search and contextual relevance\n", + "Developed NLP solutions for diverse sectors including\n", + "law, education, healthcare, and enterprise services\n", + "AI System Deployment\n", + "Integrated cloud services such as AWS (S3, Lambda, Textract, SageMaker) and Azure ML pipelines\n", + "Led agile teams of developers and QA for rapid prototyping and production-grade deployment\n", + "Utilized Docker, FastAPI, and scalable Python architectures for NLP APIs\n", + "I also apply AI to\n", + "Arabic morphology and morpheme-level analysis\n", + "to develop tools that assist in classical Arabic understanding, such as pattern-based conjugation, morphological tagging, and root extraction.\n", + "These innovations bring together AI research and production-ready NLP systems to solve complex language problems and deliver meaningful impact across industries.\n", + "📱 Mobile Apps – Qur’anic Tech in Your Pocket\n", + "Bridging the gap between sacred knowledge and modern convenience,\n", + " these mobile applications are designed to make the Qur'an and Islamic\n", + " studies accessible to everyone, anywhere, anytime.\n", + "The Noble Quran\n", + "– Official app featuring\n", + "Mufti Taqi Usmani’s authoritative English translation\n", + "of the Qur’an. Designed for students, scholars, and general readers\n", + " seeking clarity and depth in Qur’anic interpretation.\n", + "Complete English translation enriched with explanatory footnotes\n", + " based on classical Tafsir sources\n", + "Regex-based Arabic search functionality for advanced users to\n", + " explore verse patterns and linguistic structures\n", + "Streamlined verse-by-verse navigation and modern reading\n", + " experience\n", + "Offline readability, bookmarking, and search history tracking\n", + "Widely used by scholars, researchers, and institutes as a\n", + " reliable digital resource\n", + "Tazkeer-ul-Quran (Android App)\n", + "– A lightweight, modern Qur’anic reflection tool featuring\n", + " topic-based verse collections, multilingual translations, and a\n", + " clean user interface.\n", + "Explore categorized themes and Qur’anic wisdom through\n", + " handpicked verses\n", + "Multilingual support: Urdu, English, Sindhi, Pashto, and Hindi\n", + "Smart search engine allows searching in any language supported\n", + " in the app\n", + "Bookmark functionality for saving favorite verses\n", + "Designed for both general users and advanced learners\n", + "Seerat Quiz App\n", + "– A fun and engaging Islamic quiz app focused on the\n", + "Seerat (biography)\n", + "of Prophet Muhammad ﷺ, specially\n", + " designed for\n", + "kids and school-going learners\n", + ".\n", + "Built for children and beginners to explore the Seerah in an\n", + " interactive way\n", + "Multiple-choice questions to reinforce learning about the life\n", + " of the Prophet ﷺ\n", + "Child-friendly interface with easy navigation and visual\n", + " engagement\n", + "Ideal for\n", + "Islamic schools, homeschooling, and weekend\n", + " madrassahs\n", + "Score-based system to encourage progress and retention\n", + "Lightweight, responsive, and crafted for mobile-first usage\n", + "This app introduces young minds to the noble character and\n", + " important milestones in the life of the Prophet ﷺ through engaging\n", + " quizzes. It's a stepping stone toward developing love and\n", + " connection with Seerah through modern technology.\n", + "Tuheed (توَحید) App\n", + "– A mobile presentation of the classic Islamic work\n", + "\"وجود باری تعالیٰ اور توحید\"\n", + "by\n", + "Professor Dr. Malik Ghulam Murtaza (PhD)\n", + ". This app\n", + " brings the essential doctrine of\n", + "Tawheed (Monotheism)\n", + "to readers in a clean, digital\n", + " experience.\n", + "Covers the true meaning of Tawheed: the oneness of Allah in His\n", + " being, attributes, and actions — without partner, peer, or need\n", + "Explains Allah’s exclusive authority using\n", + "Qur'anic verses, rational proofs, and classical\n", + " definitions\n", + "Includes citations like Surah Al-Ikhlas and definitions from\n", + " scholars such as\n", + "Imam Al-Jurjani\n", + "Built from digitized content developed during my early work in\n", + "Urdu Islamic content digitization\n", + "projects\n", + "Urdu-language app with smooth navigation and offline readability\n", + "This app is part of my broader vision to\n", + "digitally preserve and repurpose classical Islamic\n", + " literature\n", + "—transitioning it from scanned archives to searchable web\n", + " libraries, and now to\n", + "interactive mobile applications\n", + ". It invites users\n", + " to reflect on the foundation of Islamic belief:\n", + "La ilaha illAllah\n", + "— there is no deity but Allah.\n", + "Publications\n", + "Automated Generation of Arabic Verb Conjugations with\n", + " Multilingual Urdu Translation: An NLP Approach\n", + "–\n", + "AbjadNLP 2025 Workshop, COLING\n", + "Authors: Haq Nawaz (COMSATS University, Pakistan), Manal Elobaid\n", + " (Qatar University), Ali al-Laith (Copenhagen University), Saif\n", + " Ullah (ILI.digital, Pakistan)\n", + "Read Paper (ACL Anthology)\n", + "Arabic Natural Language Processing for Qur’anic Research: A\n", + " Systematic Review\n", + "–\n", + "Artificial Intelligence Review, 2023\n", + "Authors: Muhammad Huzaifa Bashir (Information Technology\n", + " University, Pakistan), Aqil M. Azmi (King Saud University, Saudi\n", + " Arabia), Haq Nawaz (Jamia Ashrafia & PUCIT, Pakistan), Wajdi\n", + " Zaghouani (Hamad Bin Khalifa University, Qatar), Mona Diab (George\n", + " Washington University, USA), Ala Al‑Fuqaha (HBKU, Qatar), Junaid\n", + " Qadir (Qatar University)\n", + "Read on Springer\n", + "Stars at Qur’an QA 2022: Building Automatic Extractive Question\n", + " Answering Systems for the Holy Qur’an with Transformer Models and\n", + " Releasing a New Dataset\n", + "–\n", + "Qur'an QA Shared Task, OSACT Workshop, LREC 2022\n", + "Authors: Ahmed Wasfey (Tactful AI), Eman Elrefai (BambooGeeks),\n", + " Marwa Muhammad (Freelancer), Haq Nawaz (PUCIT)\n", + "Read on ACL Anthology\n", + "Sentimental Analysis of Social Media to Find Out Customer\n", + " Opinion\n", + "Intelligent Technologies and Applications, 2019\n", + "Read on Springer\n", + "Development of AI-Based System for Teaching Classical Arabic &\n", + " Qur’anic Vocabularies\n", + "QURANICA – International Journal of Quranic Research, 2018\n", + "Read on UM Journal\n", + "Data Set Generation for the Attributes of the Words of the Holy\n", + " Quran\n", + "Taibah University Conference, 2013\n", + "Read on IEEE Xplore\n", + "View all publications on Google Scholar\n", + "🏆 1st Prize – Brainiac Software Competition 2018 (UET Lahore)\n", + "Awarded for the development of\n", + "Altasreef\n", + ", an AI-powered Arabic morphology trainer that generates verb\n", + " conjugations across classical patterns along with Urdu translations.\n", + "The project was recognized for its\n", + "innovation in digitizing classical Arabic linguistics\n", + "and its utility for\n", + "Classical Arabic, language learners, and NLP researchers\n", + ". Altasreef introduced:\n", + "Automated صرف (morphology) generation in Arabic\n", + "Multilingual output: Arabic, Urdu, and English interface\n", + "NLP-inspired pattern recognition and root-based transformation\n", + "Downloadable exams for student practice\n", + "Your browser does not support the video tag.\n", + "This award recognized the project's excellence in applying\n", + " cutting-edge technology to traditional Islamic education and\n", + " showcased its relevance at the national level.\n", + "🏆 NLP Research Award – NaSCon 2019 (FAST-NUCES)\n", + "Recognized for groundbreaking personal R&D work in\n", + "Natural Language Processing of Qur’anic text\n", + ", where\n", + " I manually segmented, tagged, and annotated a large-scale dataset of\n", + " the Holy Quran for multi-language NLP applications.\n", + "The core project involved:\n", + "Tagging and annotating\n", + "over 80,000+ Quranic words\n", + "Marking\n", + "23 detailed linguistic attributes per word\n", + "including root, tense, gender, case, mood, and more\n", + "Multi-language annotation:\n", + "Arabic, Urdu, and English\n", + "Over\n", + "5.4 million total attribute labels\n", + "across\n", + " the entire corpus\n", + "Designed for advanced NLP research, educational tools, and\n", + " AI-based Quranic analysis\n", + "Your browser does not support the video tag.\n", + "This recognition at\n", + "NaSCon 2019 (FAST-NUCES)\n", + "celebrated my\n", + "independent research in the Indo-Pak Uthmani script\n", + ", and established a foundation for advanced Qur’anic datasets in\n", + " multilingual NLP environments. The annotated dataset continues to\n", + " support various AI projects in Arabic linguistics and Quranic\n", + " education.\n", + "Contact Me\n", + "Let's connect! Feel free to reach out.\n", + "Email Me\n", + "GitHub\n", + "LinkedIn\n", + "© 2025 Haq Nawaz. All rights reserved.\n" + ] + } + ], "source": [ "# Let's try one out. Change the website and add print statements to follow along.\n", "\n", - "ed = Website(\"https://edwarddonner.com\")\n", + "ed = Website(\"https://haqnawaz.org\")\n", "print(ed.title)\n", "print(ed.text)" ] @@ -260,7 +781,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "abdb8417-c5dc-44bc-9bee-2e059d162699", "metadata": {}, "outputs": [], @@ -274,7 +795,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "f0275b1b-7cfe-4f9d-abfa-7650d378da0c", "metadata": {}, "outputs": [], @@ -292,10 +813,517 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "26448ec4-5c00-4204-baec-7df91d11ff2e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "You are looking at a website titled Haq Nawaz - Bridging AI & Islamic Scholarship\n", + "The contents of this website is as follows; please provide a short summary of this website in markdown. If it includes news or announcements, then summarize these too.\n", + "\n", + "☰\n", + "Introduction\n", + "🕌 Imams of Haramain\n", + "Imam Masjid-e-Nabawi\n", + "Imam-e-Kaaba Juhany\n", + "Imam Khalid Al-Ghamidi\n", + "Projects\n", + "ISDP\n", + "Altasreef\n", + "Easy Quran\n", + "Mohaddis\n", + "Tanzeem\n", + "AI & NLP\n", + "Mobile Apps\n", + "The Noble Quran\n", + "Tazkeer Ul Quran\n", + "Seerat Quiz\n", + "وجود باری تعالیٰ اور توحید\n", + "Publications\n", + "Awards\n", + "Brainiac 2018\n", + "NaSCon 2019\n", + "Contact\n", + "Haq Nawaz\n", + "Islamic Scholar\n", + "|\n", + "NLP & AI Specialist\n", + "|\n", + "Islamic Digital Solutions Expert\n", + "About Me\n", + "Get in Touch\n", + "Introduction\n", + "I am\n", + "Haq Nawaz\n", + ", a faculty member at\n", + "Jamia Ashrafia Lahore\n", + ", a\n", + "PhD Scholar in NLP\n", + "at\n", + "COMSATS University Lahore\n", + ", and a\n", + "Data Science Consultant at ILI.DIGITAL AG\n", + ". I specialize in bridging modern artificial intelligence with\n", + " classical Islamic sciences — leading pioneering efforts in\n", + "Islamic software development\n", + ", digitization, and\n", + "AI-powered Qur'anic and Hadith tools\n", + "for education,\n", + " research, and public benefit.\n", + "As one of the earliest contributors to\n", + "Urdu Unicode content digitization\n", + ", my work has\n", + " enabled millions of words from classical texts—including the Qur’an,\n", + " Hadith, and foundational Islamic literature—to become searchable,\n", + " readable, and interactive across platforms. These efforts laid the\n", + " groundwork for major portals such as\n", + "Easy Quran wa Hadees\n", + "and\n", + "Tanzeem Islami Digital Library\n", + ".\n", + "I’ve developed award-winning educational platforms like\n", + "Altasreef\n", + ", which automates Arabic verb conjugations with Urdu translations and\n", + " exam generation, earning 1st Prize at UET Lahore’s Brainiac 2018. At\n", + " NaSCon 2019 (FAST-NUCES), my personal R&D project in\n", + "Quranic NLP annotation\n", + "—involving 5.4+ million\n", + " attribute labels in three languages—was also recognized nationally.\n", + "My mobile applications include the\n", + "The Noble Quran\n", + "and\n", + "آسان ترجمہ قرآن\n", + "apps, presenting the renowned English and Urdu translations and tafsir\n", + " by\n", + "Mufti Taqi Usmani\n", + "for scholars and general readers\n", + " alike. I’ve also developed\n", + "Tazkeer-ul-Quran\n", + ", which offers multilingual Qur’an translations and thematic\n", + " organization for deep reflection; the\n", + "Seerat Quiz\n", + "app, designed to teach Seerah to school-going children through\n", + " interactive learning; and\n", + "وجود باري تعالى اور توحید\n", + ", a digital presentation of Islamic scholarship, continuing my\n", + " mission of\n", + "digitizing authentic Islamic texts\n", + "for the\n", + " digital age.\n", + "Visit of Imam Masjid-e-Nabawi Dr. Salah Al-Budair – August 15, 2024\n", + "During the visit of\n", + "Imam Masjid-e-Nabawi Dr. Salah Al-Budair\n", + "on\n", + "August 15, 2024\n", + ", I had the honor of presenting our\n", + " research and technological contributions in the field of\n", + "Arabic morphology (علم الصرف)\n", + ". We discussed how\n", + " Natural Language Processing (NLP) and AI can simplify classical\n", + " grammar learning for students.\n", + "Your browser does not support the video tag.\n", + "Visit of Imam-e-Kaaba Dr. Sheikh Abdullah Awad Al-Juhany – April 16,\n", + " 2019\n", + "During the visit of\n", + "Imam-e-Kaaba Dr. Sheikh Abdullah Awad Al-Juhany\n", + "on\n", + "April 16, 2019\n", + ", we explored the integration of\n", + " technology in teaching\n", + "classical Arabic\n", + ". Our\n", + " discussion focused on how digital tools and platforms can enhance the\n", + " learning experience, making classical Arabic more accessible to\n", + " students worldwide.\n", + "Your browser does not support the video tag.\n", + "Visit of Imam Khalid Al-Ghamidi – 2015\n", + "During his 2015 visit to\n", + "Jamia Ashrafia\n", + ", I had\n", + " the honor of presenting my work in\n", + "Qur'anic Natural Language Processing (NLP)\n", + "and\n", + "Islamic tools\n", + "to Sheikh Khalid Al-Ghamidi, Imam\n", + " of Masjid Al-Haram. Our discussion highlighted the implementation\n", + " of\n", + "Qur'an morphological tagging\n", + ", emphasizing its role in enhancing students' understanding of\n", + " classical Arabic and deepening their comprehension of the Qur'anic\n", + " text.\n", + "🎓 Education\n", + "PhD Scholar in Computer Science (NLP & AI)\n", + "–\n", + " COMSATS University Lahore\n", + "Graduation in Dars-e-Nizami / Classical Arabic\n", + "–\n", + " Jamia Ashrafia, Lahore\n", + "MS in Computer Science\n", + "– University of Central\n", + " Punjab, Lahore\n", + "Projects & Innovations\n", + "ISDP – Intensive Software Development Program\n", + "– A groundbreaking initiative to empower graduates of Islamic\n", + " Madrasahs with modern computer science and software engineering\n", + " skills.\n", + "Tailored curriculum for scholars with no prior tech background\n", + "Practical training in web development, databases, and Python\n", + "Students build real Islamic apps and digital tools for da'wah\n", + "Promoting the digitization of Islamic knowledge through\n", + " scholar-led innovation\n", + "Graduates have secured positions in reputable software houses\n", + " such as InstaCare and E Web Craft, contributing as mobile\n", + " application and web developers.\n", + "View success stories here\n", + ".\n", + "ISDP reflects my passion for integrating sacred knowledge with\n", + " cutting-edge technology. It aims to equip our ulema with the tools\n", + " to lead in the digital world — not just follow. The success of our\n", + " graduates in the tech industry underscores the program's\n", + " effectiveness in bridging traditional Islamic scholarship with\n", + " modern technological expertise.\n", + "Altasreef\n", + "– An AI-powered Arabic morphology (علم الصرف) learning platform that\n", + " combines linguistic knowledge with NLP techniques to support\n", + " students of classical Arabic grammar.\n", + "Generates full verb conjugations for ماضی معروف، مضارع معروف،\n", + " امر، مجہول، منصوب، مجزوم، and more\n", + "Covers multiple صرف patterns (باب) like باب سمع، باب فتح، باب\n", + " نصر، باب استفعال، باب انفعال etc.\n", + "Offers full interface and output in\n", + "Urdu, English, and Arabic\n", + "Integrates rule-based NLP logic to model triliteral verb roots\n", + " with pattern-based transformations\n", + "Automatically generates\n", + "Urdu translations\n", + "using\n", + " morphology-aware translation patterns\n", + "Includes an\n", + "Online Exam Generator\n", + "to create practice worksheets for students with or without\n", + " answers (ideal for madrassah & school use)\n", + "Exam sheets can be downloaded for offline revision or classroom\n", + " printing\n", + "This project was awarded\n", + "1st Prize at the Brainiac Software Competition 2018\n", + "(UET Lahore) for digitizing Islamic linguistic education. The\n", + " underlying model and linguistic approach were also published as a\n", + " research paper at\n", + "AbjadNLP 2025 (COLING)\n", + ":\n", + "Read the paper\n", + ".\n", + "Easy Quran wa Hadees\n", + "– A groundbreaking initiative and one of the\n", + "first Urdu Unicode-based Quran and Hadith platforms in\n", + " Pakistan\n", + ". As a\n", + "pioneer developer\n", + ", I led the transformation\n", + " of classical Islamic texts into a digital, Unicode-compliant\n", + " format—setting a new benchmark in Islamic digitization.\n", + "Provides the complete Quran with authentic translations in\n", + "Urdu, English, and Arabic\n", + "Includes key Hadith collections like\n", + "Sahih Bukhari\n", + ",\n", + "Muslim\n", + ",\n", + "Abu Dawood\n", + ", and more\n", + "Uses early\n", + "NLP and intelligent indexing techniques\n", + "for\n", + " fast, root-based and keyword search\n", + "Offers advanced filters for Hadith search by narrator, topic, or\n", + " source\n", + "Audio playback support for Quranic recitation and memorization\n", + "Features bookmarking, note-taking, and tagging capabilities\n", + "Fully localized interface supporting\n", + "multilingual access\n", + "(Urdu, English, Arabic)\n", + "This platform played a\n", + "transformative role\n", + "in\n", + " opening digital Islamic access for Urdu-speaking users. Its\n", + " underlying data and architecture have been\n", + "adopted by numerous mobile apps and online platforms\n", + "across Pakistan and globally. Easy Quran wa Hadees stands as a\n", + "milestone in the history of Islamic digitization\n", + ".\n", + "Mohaddis.com\n", + "– A comprehensive Hadith research platform designed for\n", + " Urdu-speaking audiences, offering easy access to authenticated\n", + " Hadith books with cutting-edge digital tools for exploration,\n", + " referencing, and learning.\n", + "Includes\n", + "major Hadith books\n", + ", including Sahih\n", + " Bukhari, Sahih Muslim, Abu Dawood, Tirmidhi, Nasai, Ibn Majah,\n", + " and Muwatta\n", + "Equipped with\n", + "advanced full-text search\n", + "that\n", + " works across Arabic and Urdu translations\n", + "Allows filtering by\n", + "book, subject, chapter, narrator, or Hadith number\n", + "Offers parallel\n", + "Arabic and Urdu rendering\n", + "for\n", + " each Hadith\n", + "Integrated with\n", + "Fiqh-based categorization\n", + "and\n", + " references to facilitate deeper learning and contextual\n", + " understanding\n", + "Continuously updated with\n", + "editorial corrections and scholarly cross-referencing\n", + "Shareable links to every Hadith and the ability to bookmark for\n", + " future research\n", + "Mohaddis.com stands out as a\n", + "reference-grade Hadith resource\n", + "and a key part of\n", + " the modern Islamic digital library in Pakistan. Its combination of\n", + " traditional content and modern UX has made it widely adopted in\n", + " scholarly circles and educational institutes.\n", + "Tanzeem Islami Digital Library\n", + "– A pioneering content digitization project that transformed\n", + " classical Islamic literature—originally authored in Urdu and typeset\n", + " in InPage—into modern, searchable Unicode format. This initiative\n", + " laid the foundation for preserving Islamic scholarship through\n", + " technology.\n", + "Digitized and indexed a vast collection of books by\n", + "Islami thinkers, scholars, and reformers\n", + "Utilized early\n", + "InPage-to-Unicode conversion pipelines\n", + "to make\n", + " printed books digitally searchable\n", + "Enables\n", + "full-text search\n", + "across books by\n", + " keyword, topic, author, or chapter\n", + "Supported by\n", + "backend NLP tools\n", + "for content\n", + " tagging and semantic classification\n", + "Offers both web-based browsing and categorized downloadable\n", + " content (PDF + Unicode HTML)\n", + "Public access to rare Islamic literature previously locked in\n", + " print archives\n", + "As one of the\n", + "first major Urdu digitization efforts for Islamic books in\n", + " Pakistan\n", + ", this project set a trend in religious archiving and inspired\n", + " many modern Islamic libraries and apps. The platform is now\n", + " referenced by scholars, students, and researchers worldwide.\n", + "Advancing AI, NLP & LLM Solutions\n", + "I lead the development of intelligent language systems powered by\n", + "Large Language Models (LLMs)\n", + "and advanced retrieval mechanisms, applying state-of-the-art AI research to real-world applications.\n", + "Large Language Model (LLM) Solutions\n", + "Fine-tuned GPT-based models for text summarization, generation, and multi-turn conversations\n", + "Implemented Named Entity Recognition (NER), classification, and topic modeling using transformer architectures\n", + "Designed\n", + "zero-shot and few-shot learning pipelines\n", + "to support under-resourced languages like Arabic and Urdu\n", + "Retrieval-Augmented Generation (RAG) & Vector-Based Search\n", + "Built modular RAG systems combining retrieval pipelines with LLMs to deliver accurate, real-time responses\n", + "Integrated\n", + "vector databases\n", + "for semantic search and contextual relevance\n", + "Developed NLP solutions for diverse sectors including\n", + "law, education, healthcare, and enterprise services\n", + "AI System Deployment\n", + "Integrated cloud services such as AWS (S3, Lambda, Textract, SageMaker) and Azure ML pipelines\n", + "Led agile teams of developers and QA for rapid prototyping and production-grade deployment\n", + "Utilized Docker, FastAPI, and scalable Python architectures for NLP APIs\n", + "I also apply AI to\n", + "Arabic morphology and morpheme-level analysis\n", + "to develop tools that assist in classical Arabic understanding, such as pattern-based conjugation, morphological tagging, and root extraction.\n", + "These innovations bring together AI research and production-ready NLP systems to solve complex language problems and deliver meaningful impact across industries.\n", + "📱 Mobile Apps – Qur’anic Tech in Your Pocket\n", + "Bridging the gap between sacred knowledge and modern convenience,\n", + " these mobile applications are designed to make the Qur'an and Islamic\n", + " studies accessible to everyone, anywhere, anytime.\n", + "The Noble Quran\n", + "– Official app featuring\n", + "Mufti Taqi Usmani’s authoritative English translation\n", + "of the Qur’an. Designed for students, scholars, and general readers\n", + " seeking clarity and depth in Qur’anic interpretation.\n", + "Complete English translation enriched with explanatory footnotes\n", + " based on classical Tafsir sources\n", + "Regex-based Arabic search functionality for advanced users to\n", + " explore verse patterns and linguistic structures\n", + "Streamlined verse-by-verse navigation and modern reading\n", + " experience\n", + "Offline readability, bookmarking, and search history tracking\n", + "Widely used by scholars, researchers, and institutes as a\n", + " reliable digital resource\n", + "Tazkeer-ul-Quran (Android App)\n", + "– A lightweight, modern Qur’anic reflection tool featuring\n", + " topic-based verse collections, multilingual translations, and a\n", + " clean user interface.\n", + "Explore categorized themes and Qur’anic wisdom through\n", + " handpicked verses\n", + "Multilingual support: Urdu, English, Sindhi, Pashto, and Hindi\n", + "Smart search engine allows searching in any language supported\n", + " in the app\n", + "Bookmark functionality for saving favorite verses\n", + "Designed for both general users and advanced learners\n", + "Seerat Quiz App\n", + "– A fun and engaging Islamic quiz app focused on the\n", + "Seerat (biography)\n", + "of Prophet Muhammad ﷺ, specially\n", + " designed for\n", + "kids and school-going learners\n", + ".\n", + "Built for children and beginners to explore the Seerah in an\n", + " interactive way\n", + "Multiple-choice questions to reinforce learning about the life\n", + " of the Prophet ﷺ\n", + "Child-friendly interface with easy navigation and visual\n", + " engagement\n", + "Ideal for\n", + "Islamic schools, homeschooling, and weekend\n", + " madrassahs\n", + "Score-based system to encourage progress and retention\n", + "Lightweight, responsive, and crafted for mobile-first usage\n", + "This app introduces young minds to the noble character and\n", + " important milestones in the life of the Prophet ﷺ through engaging\n", + " quizzes. It's a stepping stone toward developing love and\n", + " connection with Seerah through modern technology.\n", + "Tuheed (توَحید) App\n", + "– A mobile presentation of the classic Islamic work\n", + "\"وجود باری تعالیٰ اور توحید\"\n", + "by\n", + "Professor Dr. Malik Ghulam Murtaza (PhD)\n", + ". This app\n", + " brings the essential doctrine of\n", + "Tawheed (Monotheism)\n", + "to readers in a clean, digital\n", + " experience.\n", + "Covers the true meaning of Tawheed: the oneness of Allah in His\n", + " being, attributes, and actions — without partner, peer, or need\n", + "Explains Allah’s exclusive authority using\n", + "Qur'anic verses, rational proofs, and classical\n", + " definitions\n", + "Includes citations like Surah Al-Ikhlas and definitions from\n", + " scholars such as\n", + "Imam Al-Jurjani\n", + "Built from digitized content developed during my early work in\n", + "Urdu Islamic content digitization\n", + "projects\n", + "Urdu-language app with smooth navigation and offline readability\n", + "This app is part of my broader vision to\n", + "digitally preserve and repurpose classical Islamic\n", + " literature\n", + "—transitioning it from scanned archives to searchable web\n", + " libraries, and now to\n", + "interactive mobile applications\n", + ". It invites users\n", + " to reflect on the foundation of Islamic belief:\n", + "La ilaha illAllah\n", + "— there is no deity but Allah.\n", + "Publications\n", + "Automated Generation of Arabic Verb Conjugations with\n", + " Multilingual Urdu Translation: An NLP Approach\n", + "–\n", + "AbjadNLP 2025 Workshop, COLING\n", + "Authors: Haq Nawaz (COMSATS University, Pakistan), Manal Elobaid\n", + " (Qatar University), Ali al-Laith (Copenhagen University), Saif\n", + " Ullah (ILI.digital, Pakistan)\n", + "Read Paper (ACL Anthology)\n", + "Arabic Natural Language Processing for Qur’anic Research: A\n", + " Systematic Review\n", + "–\n", + "Artificial Intelligence Review, 2023\n", + "Authors: Muhammad Huzaifa Bashir (Information Technology\n", + " University, Pakistan), Aqil M. Azmi (King Saud University, Saudi\n", + " Arabia), Haq Nawaz (Jamia Ashrafia & PUCIT, Pakistan), Wajdi\n", + " Zaghouani (Hamad Bin Khalifa University, Qatar), Mona Diab (George\n", + " Washington University, USA), Ala Al‑Fuqaha (HBKU, Qatar), Junaid\n", + " Qadir (Qatar University)\n", + "Read on Springer\n", + "Stars at Qur’an QA 2022: Building Automatic Extractive Question\n", + " Answering Systems for the Holy Qur’an with Transformer Models and\n", + " Releasing a New Dataset\n", + "–\n", + "Qur'an QA Shared Task, OSACT Workshop, LREC 2022\n", + "Authors: Ahmed Wasfey (Tactful AI), Eman Elrefai (BambooGeeks),\n", + " Marwa Muhammad (Freelancer), Haq Nawaz (PUCIT)\n", + "Read on ACL Anthology\n", + "Sentimental Analysis of Social Media to Find Out Customer\n", + " Opinion\n", + "Intelligent Technologies and Applications, 2019\n", + "Read on Springer\n", + "Development of AI-Based System for Teaching Classical Arabic &\n", + " Qur’anic Vocabularies\n", + "QURANICA – International Journal of Quranic Research, 2018\n", + "Read on UM Journal\n", + "Data Set Generation for the Attributes of the Words of the Holy\n", + " Quran\n", + "Taibah University Conference, 2013\n", + "Read on IEEE Xplore\n", + "View all publications on Google Scholar\n", + "🏆 1st Prize – Brainiac Software Competition 2018 (UET Lahore)\n", + "Awarded for the development of\n", + "Altasreef\n", + ", an AI-powered Arabic morphology trainer that generates verb\n", + " conjugations across classical patterns along with Urdu translations.\n", + "The project was recognized for its\n", + "innovation in digitizing classical Arabic linguistics\n", + "and its utility for\n", + "Classical Arabic, language learners, and NLP researchers\n", + ". Altasreef introduced:\n", + "Automated صرف (morphology) generation in Arabic\n", + "Multilingual output: Arabic, Urdu, and English interface\n", + "NLP-inspired pattern recognition and root-based transformation\n", + "Downloadable exams for student practice\n", + "Your browser does not support the video tag.\n", + "This award recognized the project's excellence in applying\n", + " cutting-edge technology to traditional Islamic education and\n", + " showcased its relevance at the national level.\n", + "🏆 NLP Research Award – NaSCon 2019 (FAST-NUCES)\n", + "Recognized for groundbreaking personal R&D work in\n", + "Natural Language Processing of Qur’anic text\n", + ", where\n", + " I manually segmented, tagged, and annotated a large-scale dataset of\n", + " the Holy Quran for multi-language NLP applications.\n", + "The core project involved:\n", + "Tagging and annotating\n", + "over 80,000+ Quranic words\n", + "Marking\n", + "23 detailed linguistic attributes per word\n", + "including root, tense, gender, case, mood, and more\n", + "Multi-language annotation:\n", + "Arabic, Urdu, and English\n", + "Over\n", + "5.4 million total attribute labels\n", + "across\n", + " the entire corpus\n", + "Designed for advanced NLP research, educational tools, and\n", + " AI-based Quranic analysis\n", + "Your browser does not support the video tag.\n", + "This recognition at\n", + "NaSCon 2019 (FAST-NUCES)\n", + "celebrated my\n", + "independent research in the Indo-Pak Uthmani script\n", + ", and established a foundation for advanced Qur’anic datasets in\n", + " multilingual NLP environments. The annotated dataset continues to\n", + " support various AI projects in Arabic linguistics and Quranic\n", + " education.\n", + "Contact Me\n", + "Let's connect! Feel free to reach out.\n", + "Email Me\n", + "GitHub\n", + "LinkedIn\n", + "© 2025 Haq Nawaz. All rights reserved.\n" + ] + } + ], "source": [ "print(user_prompt_for(ed))" ] @@ -321,7 +1349,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "f25dcd35-0cd0-4235-9f64-ac37ed9eaaa5", "metadata": {}, "outputs": [], @@ -334,10 +1362,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "21ed95c5-7001-47de-a36d-1d6673b403ce", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Oh, we're starting off easy, huh? Well, 2 + 2 equals 4. Shocking, I know! But don't worry, complex math problems are also in my repertoire. Just let me know if you want to level up!\n" + ] + } + ], "source": [ "# To give you a preview -- calling OpenAI with system and user messages:\n", "\n", @@ -355,7 +1391,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "0134dfa4-8299-48b5-b444-f2a8c3403c88", "metadata": {}, "outputs": [], @@ -371,10 +1407,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "36478464-39ee-485c-9f3f-6a4e458dbc9c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[{'role': 'system',\n", + " 'content': 'You are an assistant that analyzes the contents of a website and provides a short summary, ignoring text that might be navigation related. Respond in markdown.'},\n", + " {'role': 'user',\n", + " 'content': 'You are looking at a website titled Haq Nawaz - Bridging AI & Islamic Scholarship\\nThe contents of this website is as follows; please provide a short summary of this website in markdown. If it includes news or announcements, then summarize these too.\\n\\n☰\\nIntroduction\\n🕌 Imams of Haramain\\nImam Masjid-e-Nabawi\\nImam-e-Kaaba Juhany\\nImam Khalid Al-Ghamidi\\nProjects\\nISDP\\nAltasreef\\nEasy Quran\\nMohaddis\\nTanzeem\\nAI & NLP\\nMobile Apps\\nThe Noble Quran\\nTazkeer Ul Quran\\nSeerat Quiz\\nوجود باری تعالیٰ اور توحید\\nPublications\\nAwards\\nBrainiac 2018\\nNaSCon 2019\\nContact\\nHaq Nawaz\\nIslamic Scholar\\n|\\nNLP & AI Specialist\\n|\\nIslamic Digital Solutions Expert\\nAbout Me\\nGet in Touch\\nIntroduction\\nI am\\nHaq Nawaz\\n, a faculty member at\\nJamia Ashrafia Lahore\\n, a\\nPhD Scholar in NLP\\nat\\nCOMSATS University Lahore\\n, and a\\nData Science Consultant at ILI.DIGITAL AG\\n. I specialize in bridging modern artificial intelligence with\\n classical Islamic sciences — leading pioneering efforts in\\nIslamic software development\\n, digitization, and\\nAI-powered Qur\\'anic and Hadith tools\\nfor education,\\n research, and public benefit.\\nAs one of the earliest contributors to\\nUrdu Unicode content digitization\\n, my work has\\n enabled millions of words from classical texts—including the Qur’an,\\n Hadith, and foundational Islamic literature—to become searchable,\\n readable, and interactive across platforms. These efforts laid the\\n groundwork for major portals such as\\nEasy Quran wa Hadees\\nand\\nTanzeem Islami Digital Library\\n.\\nI’ve developed award-winning educational platforms like\\nAltasreef\\n, which automates Arabic verb conjugations with Urdu translations and\\n exam generation, earning 1st Prize at UET Lahore’s Brainiac 2018. At\\n NaSCon 2019 (FAST-NUCES), my personal R&D project in\\nQuranic NLP annotation\\n—involving 5.4+ million\\n attribute labels in three languages—was also recognized nationally.\\nMy mobile applications include the\\nThe Noble Quran\\nand\\nآسان ترجمہ قرآن\\napps, presenting the renowned English and Urdu translations and tafsir\\n by\\nMufti Taqi Usmani\\nfor scholars and general readers\\n alike. I’ve also developed\\nTazkeer-ul-Quran\\n, which offers multilingual Qur’an translations and thematic\\n organization for deep reflection; the\\nSeerat Quiz\\napp, designed to teach Seerah to school-going children through\\n interactive learning; and\\nوجود باري تعالى اور توحید\\n, a digital presentation of Islamic scholarship, continuing my\\n mission of\\ndigitizing authentic Islamic texts\\nfor the\\n digital age.\\nVisit of Imam Masjid-e-Nabawi Dr. Salah Al-Budair – August 15, 2024\\nDuring the visit of\\nImam Masjid-e-Nabawi Dr. Salah Al-Budair\\non\\nAugust 15, 2024\\n, I had the honor of presenting our\\n research and technological contributions in the field of\\nArabic morphology (علم الصرف)\\n. We discussed how\\n Natural Language Processing (NLP) and AI can simplify classical\\n grammar learning for students.\\nYour browser does not support the video tag.\\nVisit of Imam-e-Kaaba Dr. Sheikh Abdullah Awad Al-Juhany – April 16,\\n 2019\\nDuring the visit of\\nImam-e-Kaaba Dr. Sheikh Abdullah Awad Al-Juhany\\non\\nApril 16, 2019\\n, we explored the integration of\\n technology in teaching\\nclassical Arabic\\n. Our\\n discussion focused on how digital tools and platforms can enhance the\\n learning experience, making classical Arabic more accessible to\\n students worldwide.\\nYour browser does not support the video tag.\\nVisit of Imam Khalid Al-Ghamidi – 2015\\nDuring his 2015 visit to\\nJamia Ashrafia\\n, I had\\n the honor of presenting my work in\\nQur\\'anic Natural Language Processing (NLP)\\nand\\nIslamic tools\\nto Sheikh Khalid Al-Ghamidi, Imam\\n of Masjid Al-Haram. Our discussion highlighted the implementation\\n of\\nQur\\'an morphological tagging\\n, emphasizing its role in enhancing students\\' understanding of\\n classical Arabic and deepening their comprehension of the Qur\\'anic\\n text.\\n🎓 Education\\nPhD Scholar in Computer Science (NLP & AI)\\n–\\n COMSATS University Lahore\\nGraduation in Dars-e-Nizami / Classical Arabic\\n–\\n Jamia Ashrafia, Lahore\\nMS in Computer Science\\n– University of Central\\n Punjab, Lahore\\nProjects & Innovations\\nISDP – Intensive Software Development Program\\n– A groundbreaking initiative to empower graduates of Islamic\\n Madrasahs with modern computer science and software engineering\\n skills.\\nTailored curriculum for scholars with no prior tech background\\nPractical training in web development, databases, and Python\\nStudents build real Islamic apps and digital tools for da\\'wah\\nPromoting the digitization of Islamic knowledge through\\n scholar-led innovation\\nGraduates have secured positions in reputable software houses\\n such as InstaCare and E Web Craft, contributing as mobile\\n application and web developers.\\nView success stories here\\n.\\nISDP reflects my passion for integrating sacred knowledge with\\n cutting-edge technology. It aims to equip our ulema with the tools\\n to lead in the digital world — not just follow. The success of our\\n graduates in the tech industry underscores the program\\'s\\n effectiveness in bridging traditional Islamic scholarship with\\n modern technological expertise.\\nAltasreef\\n– An AI-powered Arabic morphology (علم الصرف) learning platform that\\n combines linguistic knowledge with NLP techniques to support\\n students of classical Arabic grammar.\\nGenerates full verb conjugations for ماضی معروف، مضارع معروف،\\n امر، مجہول، منصوب، مجزوم، and more\\nCovers multiple صرف patterns (باب) like باب سمع، باب فتح، باب\\n نصر، باب استفعال، باب انفعال etc.\\nOffers full interface and output in\\nUrdu, English, and Arabic\\nIntegrates rule-based NLP logic to model triliteral verb roots\\n with pattern-based transformations\\nAutomatically generates\\nUrdu translations\\nusing\\n morphology-aware translation patterns\\nIncludes an\\nOnline Exam Generator\\nto create practice worksheets for students with or without\\n answers (ideal for madrassah & school use)\\nExam sheets can be downloaded for offline revision or classroom\\n printing\\nThis project was awarded\\n1st Prize at the Brainiac Software Competition 2018\\n(UET Lahore) for digitizing Islamic linguistic education. The\\n underlying model and linguistic approach were also published as a\\n research paper at\\nAbjadNLP 2025 (COLING)\\n:\\nRead the paper\\n.\\nEasy Quran wa Hadees\\n– A groundbreaking initiative and one of the\\nfirst Urdu Unicode-based Quran and Hadith platforms in\\n Pakistan\\n. As a\\npioneer developer\\n, I led the transformation\\n of classical Islamic texts into a digital, Unicode-compliant\\n format—setting a new benchmark in Islamic digitization.\\nProvides the complete Quran with authentic translations in\\nUrdu, English, and Arabic\\nIncludes key Hadith collections like\\nSahih Bukhari\\n,\\nMuslim\\n,\\nAbu Dawood\\n, and more\\nUses early\\nNLP and intelligent indexing techniques\\nfor\\n fast, root-based and keyword search\\nOffers advanced filters for Hadith search by narrator, topic, or\\n source\\nAudio playback support for Quranic recitation and memorization\\nFeatures bookmarking, note-taking, and tagging capabilities\\nFully localized interface supporting\\nmultilingual access\\n(Urdu, English, Arabic)\\nThis platform played a\\ntransformative role\\nin\\n opening digital Islamic access for Urdu-speaking users. Its\\n underlying data and architecture have been\\nadopted by numerous mobile apps and online platforms\\nacross Pakistan and globally. Easy Quran wa Hadees stands as a\\nmilestone in the history of Islamic digitization\\n.\\nMohaddis.com\\n– A comprehensive Hadith research platform designed for\\n Urdu-speaking audiences, offering easy access to authenticated\\n Hadith books with cutting-edge digital tools for exploration,\\n referencing, and learning.\\nIncludes\\nmajor Hadith books\\n, including Sahih\\n Bukhari, Sahih Muslim, Abu Dawood, Tirmidhi, Nasai, Ibn Majah,\\n and Muwatta\\nEquipped with\\nadvanced full-text search\\nthat\\n works across Arabic and Urdu translations\\nAllows filtering by\\nbook, subject, chapter, narrator, or Hadith number\\nOffers parallel\\nArabic and Urdu rendering\\nfor\\n each Hadith\\nIntegrated with\\nFiqh-based categorization\\nand\\n references to facilitate deeper learning and contextual\\n understanding\\nContinuously updated with\\neditorial corrections and scholarly cross-referencing\\nShareable links to every Hadith and the ability to bookmark for\\n future research\\nMohaddis.com stands out as a\\nreference-grade Hadith resource\\nand a key part of\\n the modern Islamic digital library in Pakistan. Its combination of\\n traditional content and modern UX has made it widely adopted in\\n scholarly circles and educational institutes.\\nTanzeem Islami Digital Library\\n– A pioneering content digitization project that transformed\\n classical Islamic literature—originally authored in Urdu and typeset\\n in InPage—into modern, searchable Unicode format. This initiative\\n laid the foundation for preserving Islamic scholarship through\\n technology.\\nDigitized and indexed a vast collection of books by\\nIslami thinkers, scholars, and reformers\\nUtilized early\\nInPage-to-Unicode conversion pipelines\\nto make\\n printed books digitally searchable\\nEnables\\nfull-text search\\nacross books by\\n keyword, topic, author, or chapter\\nSupported by\\nbackend NLP tools\\nfor content\\n tagging and semantic classification\\nOffers both web-based browsing and categorized downloadable\\n content (PDF + Unicode HTML)\\nPublic access to rare Islamic literature previously locked in\\n print archives\\nAs one of the\\nfirst major Urdu digitization efforts for Islamic books in\\n Pakistan\\n, this project set a trend in religious archiving and inspired\\n many modern Islamic libraries and apps. The platform is now\\n referenced by scholars, students, and researchers worldwide.\\nAdvancing AI, NLP & LLM Solutions\\nI lead the development of intelligent language systems powered by\\nLarge Language Models (LLMs)\\nand advanced retrieval mechanisms, applying state-of-the-art AI research to real-world applications.\\nLarge Language Model (LLM) Solutions\\nFine-tuned GPT-based models for text summarization, generation, and multi-turn conversations\\nImplemented Named Entity Recognition (NER), classification, and topic modeling using transformer architectures\\nDesigned\\nzero-shot and few-shot learning pipelines\\nto support under-resourced languages like Arabic and Urdu\\nRetrieval-Augmented Generation (RAG) & Vector-Based Search\\nBuilt modular RAG systems combining retrieval pipelines with LLMs to deliver accurate, real-time responses\\nIntegrated\\nvector databases\\nfor semantic search and contextual relevance\\nDeveloped NLP solutions for diverse sectors including\\nlaw, education, healthcare, and enterprise services\\nAI System Deployment\\nIntegrated cloud services such as AWS (S3, Lambda, Textract, SageMaker) and Azure ML pipelines\\nLed agile teams of developers and QA for rapid prototyping and production-grade deployment\\nUtilized Docker, FastAPI, and scalable Python architectures for NLP APIs\\nI also apply AI to\\nArabic morphology and morpheme-level analysis\\nto develop tools that assist in classical Arabic understanding, such as pattern-based conjugation, morphological tagging, and root extraction.\\nThese innovations bring together AI research and production-ready NLP systems to solve complex language problems and deliver meaningful impact across industries.\\n📱 Mobile Apps – Qur’anic Tech in Your Pocket\\nBridging the gap between sacred knowledge and modern convenience,\\n these mobile applications are designed to make the Qur\\'an and Islamic\\n studies accessible to everyone, anywhere, anytime.\\nThe Noble Quran\\n– Official app featuring\\nMufti Taqi Usmani’s authoritative English translation\\nof the Qur’an. Designed for students, scholars, and general readers\\n seeking clarity and depth in Qur’anic interpretation.\\nComplete English translation enriched with explanatory footnotes\\n based on classical Tafsir sources\\nRegex-based Arabic search functionality for advanced users to\\n explore verse patterns and linguistic structures\\nStreamlined verse-by-verse navigation and modern reading\\n experience\\nOffline readability, bookmarking, and search history tracking\\nWidely used by scholars, researchers, and institutes as a\\n reliable digital resource\\nTazkeer-ul-Quran (Android App)\\n– A lightweight, modern Qur’anic reflection tool featuring\\n topic-based verse collections, multilingual translations, and a\\n clean user interface.\\nExplore categorized themes and Qur’anic wisdom through\\n handpicked verses\\nMultilingual support: Urdu, English, Sindhi, Pashto, and Hindi\\nSmart search engine allows searching in any language supported\\n in the app\\nBookmark functionality for saving favorite verses\\nDesigned for both general users and advanced learners\\nSeerat Quiz App\\n– A fun and engaging Islamic quiz app focused on the\\nSeerat (biography)\\nof Prophet Muhammad ﷺ, specially\\n designed for\\nkids and school-going learners\\n.\\nBuilt for children and beginners to explore the Seerah in an\\n interactive way\\nMultiple-choice questions to reinforce learning about the life\\n of the Prophet ﷺ\\nChild-friendly interface with easy navigation and visual\\n engagement\\nIdeal for\\nIslamic schools, homeschooling, and weekend\\n madrassahs\\nScore-based system to encourage progress and retention\\nLightweight, responsive, and crafted for mobile-first usage\\nThis app introduces young minds to the noble character and\\n important milestones in the life of the Prophet ﷺ through engaging\\n quizzes. It\\'s a stepping stone toward developing love and\\n connection with Seerah through modern technology.\\nTuheed (توَحید) App\\n– A mobile presentation of the classic Islamic work\\n\"وجود باری تعالیٰ اور توحید\"\\nby\\nProfessor Dr. Malik Ghulam Murtaza (PhD)\\n. This app\\n brings the essential doctrine of\\nTawheed (Monotheism)\\nto readers in a clean, digital\\n experience.\\nCovers the true meaning of Tawheed: the oneness of Allah in His\\n being, attributes, and actions — without partner, peer, or need\\nExplains Allah’s exclusive authority using\\nQur\\'anic verses, rational proofs, and classical\\n definitions\\nIncludes citations like Surah Al-Ikhlas and definitions from\\n scholars such as\\nImam Al-Jurjani\\nBuilt from digitized content developed during my early work in\\nUrdu Islamic content digitization\\nprojects\\nUrdu-language app with smooth navigation and offline readability\\nThis app is part of my broader vision to\\ndigitally preserve and repurpose classical Islamic\\n literature\\n—transitioning it from scanned archives to searchable web\\n libraries, and now to\\ninteractive mobile applications\\n. It invites users\\n to reflect on the foundation of Islamic belief:\\nLa ilaha illAllah\\n— there is no deity but Allah.\\nPublications\\nAutomated Generation of Arabic Verb Conjugations with\\n Multilingual Urdu Translation: An NLP Approach\\n–\\nAbjadNLP 2025 Workshop, COLING\\nAuthors: Haq Nawaz (COMSATS University, Pakistan), Manal Elobaid\\n (Qatar University), Ali al-Laith (Copenhagen University), Saif\\n Ullah (ILI.digital, Pakistan)\\nRead Paper (ACL Anthology)\\nArabic Natural Language Processing for Qur’anic Research: A\\n Systematic Review\\n–\\nArtificial Intelligence Review, 2023\\nAuthors: Muhammad Huzaifa Bashir (Information Technology\\n University, Pakistan), Aqil M. Azmi (King Saud University, Saudi\\n Arabia), Haq Nawaz (Jamia Ashrafia & PUCIT, Pakistan), Wajdi\\n Zaghouani (Hamad Bin Khalifa University, Qatar), Mona Diab (George\\n Washington University, USA), Ala Al‑Fuqaha (HBKU, Qatar), Junaid\\n Qadir (Qatar University)\\nRead on Springer\\nStars at Qur’an QA 2022: Building Automatic Extractive Question\\n Answering Systems for the Holy Qur’an with Transformer Models and\\n Releasing a New Dataset\\n–\\nQur\\'an QA Shared Task, OSACT Workshop, LREC 2022\\nAuthors: Ahmed Wasfey (Tactful AI), Eman Elrefai (BambooGeeks),\\n Marwa Muhammad (Freelancer), Haq Nawaz (PUCIT)\\nRead on ACL Anthology\\nSentimental Analysis of Social Media to Find Out Customer\\n Opinion\\nIntelligent Technologies and Applications, 2019\\nRead on Springer\\nDevelopment of AI-Based System for Teaching Classical Arabic &\\n Qur’anic Vocabularies\\nQURANICA – International Journal of Quranic Research, 2018\\nRead on UM Journal\\nData Set Generation for the Attributes of the Words of the Holy\\n Quran\\nTaibah University Conference, 2013\\nRead on IEEE Xplore\\nView all publications on Google Scholar\\n🏆 1st Prize – Brainiac Software Competition 2018 (UET Lahore)\\nAwarded for the development of\\nAltasreef\\n, an AI-powered Arabic morphology trainer that generates verb\\n conjugations across classical patterns along with Urdu translations.\\nThe project was recognized for its\\ninnovation in digitizing classical Arabic linguistics\\nand its utility for\\nClassical Arabic, language learners, and NLP researchers\\n. Altasreef introduced:\\nAutomated صرف (morphology) generation in Arabic\\nMultilingual output: Arabic, Urdu, and English interface\\nNLP-inspired pattern recognition and root-based transformation\\nDownloadable exams for student practice\\nYour browser does not support the video tag.\\nThis award recognized the project\\'s excellence in applying\\n cutting-edge technology to traditional Islamic education and\\n showcased its relevance at the national level.\\n🏆 NLP Research Award – NaSCon 2019 (FAST-NUCES)\\nRecognized for groundbreaking personal R&D work in\\nNatural Language Processing of Qur’anic text\\n, where\\n I manually segmented, tagged, and annotated a large-scale dataset of\\n the Holy Quran for multi-language NLP applications.\\nThe core project involved:\\nTagging and annotating\\nover 80,000+ Quranic words\\nMarking\\n23 detailed linguistic attributes per word\\nincluding root, tense, gender, case, mood, and more\\nMulti-language annotation:\\nArabic, Urdu, and English\\nOver\\n5.4 million total attribute labels\\nacross\\n the entire corpus\\nDesigned for advanced NLP research, educational tools, and\\n AI-based Quranic analysis\\nYour browser does not support the video tag.\\nThis recognition at\\nNaSCon 2019 (FAST-NUCES)\\ncelebrated my\\nindependent research in the Indo-Pak Uthmani script\\n, and established a foundation for advanced Qur’anic datasets in\\n multilingual NLP environments. The annotated dataset continues to\\n support various AI projects in Arabic linguistics and Quranic\\n education.\\nContact Me\\nLet\\'s connect! Feel free to reach out.\\nEmail Me\\nGitHub\\nLinkedIn\\n© 2025 Haq Nawaz. All rights reserved.'}]" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Try this out, and then try for a few more websites\n", "\n", @@ -391,7 +1441,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "905b9919-aba7-45b5-ae65-81b3d1d78e34", "metadata": {}, "outputs": [], @@ -409,17 +1459,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "05e38d41-dfa4-4b20-9c96-c46ea75d9fb5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "\"# Haq Nawaz - Bridging AI & Islamic Scholarship\\n\\n**Overview** \\nHaq Nawaz is a faculty member at Jamia Ashrafia Lahore and a PhD Scholar in Natural Language Processing (NLP) at COMSATS University Lahore. He specializes in integrating modern AI technologies with Islamic scholarship, aiming to develop educational tools that digitize and enhance accessibility to classical Islamic texts.\\n\\n**Core Focus Areas**\\n\\n- **Islamic Digital Solutions**: Development of software and applications that facilitate the study and understanding of the Quran and Hadith, such as:\\n - **Altasreef**: An AI-powered Arabic morphology learning platform that automates verb conjugations.\\n - **Easy Quran and Hadith**: A platform providing translations and search functionality for key Islamic texts.\\n - **Mobile Apps**: Including The Noble Quran and Tazkeer Ul Quran, which offer user-friendly access to Quranic content.\\n\\n- **Education Initiatives**: He leads various projects like the Intensive Software Development Program (ISDP), aimed at empowering graduates from Madrasahs with tech skills to develop Islamic digital tools.\\n\\n- **Research and Publications**: Haq Nawaz has contributed to numerous academic publications that focus on applying NLP techniques to Islamic texts, with notable awards for his work in transforming classical Arabic learning through technology.\\n\\n**Recent News & Announcements**\\n- **Visitation Highlights**:\\n - **August 15, 2024**: Presentation to Imam Masjid-e-Nabawi Dr. Salah Al-Budair focusing on the role of NLP in teaching Arabic grammar.\\n - **April 16, 2019**: Discussion with Imam-e-Kaaba Dr. Sheikh Abdullah Awad Al-Juhany on integrating technology in classical Arabic education.\\n - **2015**: Presentation to Imam Khalid Al-Ghamidi on the applications of Qur'anic NLP in enhancing students' learning.\\n\\n**Achievements**\\n- Awarded 1st Prize at Brainiac 2018 for Altasreef.\\n- Received the NLP Research Award at NaSCon 2019 for groundbreaking work in Quranic NLP annotation.\\n\\nThis website emphasizes Haq Nawaz's commitment to advancing Islamic scholarship through technology and innovative educational methodologies, reflecting a unique intersection of traditional knowledge and modern digital resources.\"" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "summarize(\"https://edwarddonner.com\")" + "summarize(\"https://haqnawaz.org\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "id": "3d926d59-450e-4609-92ba-2d6f244f1342", "metadata": {}, "outputs": [], @@ -433,14 +1494,58 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "id": "3018853a-445f-41ff-9560-d925d1774b2f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/markdown": [ + "# Haq Nawaz - Bridging AI & Islamic Scholarship\n", + "\n", + "**Overview** \n", + "Haq Nawaz is an accomplished Islamic scholar and NLP (Natural Language Processing) specialist who integrates artificial intelligence with classical Islamic scholarship. He serves as a faculty member at Jamia Ashrafia in Lahore, while also pursuing a PhD in NLP at COMSATS University. His work primarily focuses on the development of digital tools for education and research in Islamic studies, enabling classical texts to become more accessible and interactive.\n", + "\n", + "**Key Projects and Innovations** \n", + "- **ISDP**: An intensive software development program that equips graduates of Islamic Madrasahs with tech skills, enabling them to develop Islamic digital tools.\n", + "- **Altasreef**: An AI-powered Arabic morphology learning platform, awarded 1st prize at the Brainiac 2018 competition.\n", + "- **Easy Quran wa Hadees**: A pioneering Urdu Unicode-based Quran and Hadith platform providing comprehensive search and access to these texts.\n", + "- **Mohaddis.com**: A research platform for authenticated Hadith texts designed for Urdu-speaking audiences.\n", + "- **Tanzeem Islami Digital Library**: A project digitizing classical Urdu literature into searchable formats.\n", + "- **Mobile Apps**: Includes apps like The Noble Quran, Tazkeer-ul-Quran, Seerat Quiz, and the Tuheed app, bridging sacred knowledge with modern mobile technology.\n", + "\n", + "**Recognitions and Achievements** \n", + "Haq Nawaz has received notable awards such as:\n", + "- **1st Prize** at the Brainiac Software Competition 2018 for Altasreef.\n", + "- Recognition for his research in NLP at NaSCon 2019 for his work on Qur’anic text annotation.\n", + "\n", + "**Recent News** \n", + "- **Visit of Imam Masjid-e-Nabawi (August 15, 2024)**: Haq Nawaz presented his research in Arabic morphology and discussed using NLP and AI to simplify classical grammar learning.\n", + "- **Visit of Imam-e-Kaaba (April 16, 2019)**: Discussed how technology can enhance classical Arabic teaching.\n", + "- **Visit of Imam Khalid Al-Ghamidi (2015)**: Presented work on Qur'anic NLP to emphasize understanding classical Arabic through technology.\n", + "\n", + "Haq Nawaz continues his efforts to digitize Islamic texts and leverage technology for educational purposes, ultimately making Islamic knowledge more accessible to a global audience." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "display_summary(\"https://edwarddonner.com\")" + "display_summary(\"https://haqnawaz.org\")" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "40020de6", + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "id": "b3bcf6f4-adce-45e9-97ad-d9a5d7a3a624", @@ -573,7 +1678,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "venv", "language": "python", "name": "python3" }, @@ -587,7 +1692,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.11" + "version": "3.10.0" } }, "nbformat": 4, diff --git a/week1/day2 EXERCISE.ipynb b/week1/day2 EXERCISE.ipynb index 2c079f1..f95eb3a 100644 --- a/week1/day2 EXERCISE.ipynb +++ b/week1/day2 EXERCISE.ipynb @@ -68,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "4e2a9393-7767-488e-a8bf-27c12dca35bd", "metadata": {}, "outputs": [], @@ -82,7 +82,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "29ddd15d-a3c5-4f4e-a678-873f56162724", "metadata": {}, "outputs": [], @@ -96,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "dac0a679-599c-441f-9bf2-ddc73d35b940", "metadata": {}, "outputs": [], @@ -110,7 +110,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "7bb9c624-14f0-4945-a719-8ddb64f66f47", "metadata": {}, "outputs": [], @@ -124,10 +124,46 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, + "id": "4f2ae8e2", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAME ID SIZE MODIFIED \n", + "llama3.2:latest a80c4f17acd5 2.0 GB 3 minutes ago \n" + ] + } + ], + "source": [ + "!ollama list\n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, "id": "479ff514-e8bd-4985-a572-2ea28bb4fa40", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠋ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠙ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠹ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠸ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠼ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠴ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠦ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠧ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠇ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠏ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠋ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠙ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠹ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠸ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠼ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠴ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠦ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠧ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠇ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠏ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠋ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest \u001b[K\n", + "pulling dde5aa3fc5ff... 100% ▕████████████████▏ 2.0 GB \u001b[K\n", + "pulling 966de95ca8a6... 100% ▕████████████████▏ 1.4 KB \u001b[K\n", + "pulling fcc5a6bec9da... 100% ▕████████████████▏ 7.7 KB \u001b[K\n", + "pulling a70ff7e570d9... 100% ▕████████████████▏ 6.0 KB \u001b[K\n", + "pulling 56bb8bd477a5... 100% ▕████████████████▏ 96 B \u001b[K\n", + "pulling 34bb5ab01051... 100% ▕████████████████▏ 561 B \u001b[K\n", + "verifying sha256 digest \u001b[K\n", + "writing manifest \u001b[K\n", + "success \u001b[K\u001b[?25h\u001b[?2026l\n" + ] + } + ], "source": [ "# Let's just make sure the model is loaded\n", "\n", @@ -136,10 +172,38 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "42b9f644-522d-4e05-a691-56e7658c0ea9", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Generative AI has numerous business applications across various industries. Here are some examples:\n", + "\n", + "1. **Content Creation**: Generative AI can generate high-quality content such as articles, blog posts, social media posts, and even entire books. This technology is particularly useful for businesses that need to create a large amount of content quickly, but may not have the resources or expertise in-house.\n", + "2. **Visual Content Generation**: Generative AI can create visual content like images, videos, and 3D models. This technology is commonly used in advertising, marketing, and e-commerce to create visually appealing products, product demos, and social media campaigns.\n", + "3. **Chatbots and Virtual Assistants**: Generative AI can power chatbots and virtual assistants that provide customer support, answer frequently asked questions, and engage with customers in a more human-like way.\n", + "4. **Data Analysis and Insights**: Generative AI can analyze large datasets and generate insights, predictions, and recommendations. This technology is commonly used in data science, marketing analytics, and business intelligence to help organizations make data-driven decisions.\n", + "5. **Product Design and Development**: Generative AI can assist designers and engineers in product development by generating ideas, designs, and prototypes quickly and efficiently.\n", + "6. **Marketing Automation**: Generative AI can automate marketing campaigns by generating personalized content, emails, and social media posts based on customer behavior and preferences.\n", + "7. **Personalization**: Generative AI can help businesses personalize their products and services to individual customers based on their behavior, preferences, and demographics.\n", + "8. **Cybersecurity**: Generative AI can be used to detect and respond to cyber threats by analyzing network traffic, identifying patterns, and predicting potential attacks.\n", + "9. **Predictive Maintenance**: Generative AI can analyze equipment data and predict when maintenance is required, reducing downtime and increasing productivity.\n", + "10. **Autonomous Systems**: Generative AI can enable the development of autonomous systems that can operate independently, making decisions based on real-time data and feedback.\n", + "\n", + "Some specific industries that are already using generative AI include:\n", + "\n", + "1. **Retail**: Companies like Walmart and Amazon use generative AI to personalize customer experiences, optimize supply chains, and automate marketing campaigns.\n", + "2. **Finance**: Financial institutions like JPMorgan Chase and Goldman Sachs use generative AI to analyze financial data, predict market trends, and identify investment opportunities.\n", + "3. **Healthcare**: Medical organizations like the Mayo Clinic and Johnson & Johnson use generative AI to analyze medical images, diagnose diseases, and develop personalized treatment plans.\n", + "4. **Manufacturing**: Companies like Siemens and GE Aviation use generative AI to optimize production processes, design new products, and predict maintenance needs.\n", + "\n", + "These are just a few examples of the many business applications of Generative AI. As the technology continues to evolve, we can expect to see even more innovative uses across various industries.\n" + ] + } + ], "source": [ "# If this doesn't work for any reason, try the 2 versions in the following cells\n", "# And double check the instructions in the 'Recap on installation of Ollama' at the top of this lab\n", @@ -163,10 +227,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "7745b9c4-57dc-4867-9180-61fa5db55eb8", "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "ModuleNotFoundError", + "evalue": "No module named 'ollama'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[1;32mIn[20], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mollama\u001b[39;00m\n\u001b[0;32m 3\u001b[0m response \u001b[38;5;241m=\u001b[39m ollama\u001b[38;5;241m.\u001b[39mchat(model\u001b[38;5;241m=\u001b[39mMODEL, messages\u001b[38;5;241m=\u001b[39mmessages)\n\u001b[0;32m 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(response[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmessage\u001b[39m\u001b[38;5;124m'\u001b[39m][\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcontent\u001b[39m\u001b[38;5;124m'\u001b[39m])\n", + "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'ollama'" + ] + } + ], "source": [ "import ollama\n", "\n", @@ -184,10 +260,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "23057e00-b6fc-4678-93a9-6b31cb704bff", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Generative AI (GeAI) has numerous business applications across various industries. Here are some examples:\n", + "\n", + "1. **Content Generation**: GeAI can create high-quality content such as articles, social media posts, product descriptions, and even entire books. This technology is being used by companies to automate the creation of content, reducing the need for human writers and improving efficiency.\n", + "2. **Virtual Assistants**: GeAI-powered virtual assistants can be used to build conversational interfaces for customer service, sales, and other applications. These AI-powered chatbots can provide personalized support, recommend products, and help customers with queries.\n", + "3. **Marketing Automation**: GeAI can generate targeted marketing campaigns using real-time data analytics, social media insights, and behavioral patterns. This technology helps businesses personalize their marketing messages, improving engagement rates and conversion rates.\n", + "4. **Product Design and Development**: GeAI-powered design tools can create product prototypes, suggest design variations, and even automate product prototyping using AI-generated 3D models.\n", + "5. **Image Recognition and Classification**: GeAI can analyze large volumes of images and identify patterns, objects, and people. This technology is being used in applications such as facial recognition, object detection, and medical image analysis.\n", + "6. **Predictive Maintenance**: GeAI-powered predictive maintenance systems can predict equipment failures, detect anomalies in network traffic, and even recommend proactive maintenance schedules.\n", + "7. **Customer Service Chatbots**: GeAI-powered chatbots can provide 24/7 customer support, answering common queries, resolving basic issues, and routing complex problems to human support agents.\n", + "8. **Creative Writing Assistance**: GeAI-powered writing tools can assist writers with content ideas, suggestions for rewording or paraphrasing text, and optimizing the style of their work.\n", + "9. **Business Strategy Development**: GeAI can analyze large datasets, identify industry trends, and provide recommendations for business strategy development.\n", + "10. **Speech Synthesis and Voice Assistants**: GeAI-powered speech synthesis systems can generate natural-sounding voices, automating tasks such as text-to-speech and voice-based customer support.\n", + "\n", + "These are just a few examples of the many potential applications of Generative AI in various industries. As the technology advances, we can expect to see even more innovative uses of GeAI across businesses and organizations.\n", + "\n", + "In addition to these specific business applications, Generative AI also poses potential risks and challenges, including:\n", + "\n", + "* Job displacement\n", + "* Data quality issues\n", + "* Bias in decision-making systems\n", + "* Dependence on AI for critical tasks\n", + "\n", + "As with any emerging technology, it is essential for businesses to carefully consider the benefits and drawbacks of using GeAI and to develop responsible guidelines and regulations for its use.\n" + ] + } + ], "source": [ "# There's actually an alternative approach that some people might prefer\n", "# You can use the OpenAI client python library to call Ollama:\n", @@ -285,16 +391,95 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "id": "6de38216-6d1c-48c4-877b-86d403f4e0f8", "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "This is a basic HTML template for a website. Here's a summary of the key elements:\n", + "\n", + "1. **Head Section**:\n", + "\t* Specifies the character encoding (UTF-8) and viewport settings.\n", + "\t* Links to external resources, including:\n", + "\t\t+ Font Awesome CDN for icons\n", + "\t\t+ Google Fonts for typography (Inter)\n", + "\t\t+ A favicon image\n", + "\t* References an internal stylesheet (`style.css`) for CSS layout.\n", + "\n", + "2. **Title**:\n", + "\t* Sets the title of the webpage (\"Haq Nawaz - Bridging AI & Islamic Scholarship\").\n", + "\n", + "3. **JavaScript Code**:\n", + "\t* Handles menu toggling on mobile devices.\n", + "\t+ Adds a click event listener to toggle the `.nav-links` class and update the hamburger icon's text.\n", + "\t+ Closes the menu when clicking outside the `nav` element or a dropdown.\n", + "\n", + "4. **Layout**:\n", + "\t* The code snippets above suggest that the webpage uses a basic layout with a hamburger menu, which is toggled using JavaScript.\n", + "\n", + "However, without more information about the complete HTML structure and code, it's difficult to provide a detailed explanation of how this template interacts with other pages or external resources. \n", + "\n", + "There are several potential security issues:\n", + "\n", + "* The link integrity is specified incorrectly with `...your-integrity-key...\",` should be replaced by a valid hash for Font Awesome.\n", + "* The `crossorigin=\"anonymous\"`, setting prevents proper DNS lookup, and may cause issues.\n", + "\n", + "The given template seems to be missing a few sections typically found in an HTML page, such as:\n", + "\n", + "- `` tag,\n", + "- Content,\n", + "- footer" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from openai import OpenAI\n", + "from IPython.display import display, Markdown\n", + "\n", + "openai = OpenAI(\n", + " base_url=\"http://localhost:11434/v1\",\n", + " api_key=\"ollama\"\n", + ")\n", + "\n", + "def messages_for(content):\n", + " return [{\"role\": \"user\", \"content\": f\"Summarize this website:\\n{content}\"}]\n", + "\n", + "def summarize(url):\n", + " import requests\n", + " website = requests.get(url).text[:2000] # Keep it short for local model\n", + " response = openai.chat.completions.create(\n", + " model=\"llama3.2\",\n", + " messages=messages_for(website)\n", + " )\n", + " return response.choices[0].message.content\n", + "\n", + "def display_summary(url):\n", + " summary = summarize(url)\n", + " display(Markdown(summary))\n", + "\n", + "display_summary(\"https://haqnawaz.org\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "29563f16", + "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "venv", "language": "python", "name": "python3" }, @@ -308,7 +493,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.11" + "version": "3.10.0rc2" } }, "nbformat": 4, diff --git a/week1/day5.ipynb b/week1/day5.ipynb index 2d02cdf..d14b800 100644 --- a/week1/day5.ipynb +++ b/week1/day5.ipynb @@ -22,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "d5b08506-dc8b-4443-9201-5f1848161363", "metadata": {}, "outputs": [], @@ -42,10 +42,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "fc5d8880-f2ee-4c06-af16-ecbc0262af61", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "API key looks good so far\n" + ] + } + ], "source": [ "# Initialize and constants\n", "\n", @@ -63,7 +71,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "106dd65e-90af-4ca8-86b6-23a41840645b", "metadata": {}, "outputs": [], @@ -101,12 +109,75 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "e30d8128-933b-44cc-81c8-ab4c9d86589a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['#introduction',\n", + " '#imam-budair',\n", + " '#imam-juhany',\n", + " '#imam-ghamidi',\n", + " '#isdp',\n", + " '#altasreef',\n", + " '#easyquran',\n", + " '#mohaddis',\n", + " '#tanzeem',\n", + " '#ai-nlp-expertise',\n", + " '#The-Noble-Quran',\n", + " '#Tazkeer-ul-Quran',\n", + " '#seerat-quiz',\n", + " '#tuheed',\n", + " '#publications',\n", + " '#brainiac',\n", + " '#nascon',\n", + " '#contact',\n", + " '#introduction',\n", + " '#contact',\n", + " 'https://jamiaashrafia.org/',\n", + " 'https://ili.digital/',\n", + " 'https://www.easyquranwahadees.com/',\n", + " 'https://tanzeemdigitallibrary.com/',\n", + " 'https://altasreef.vercel.app',\n", + " 'https://play.google.com/store/apps/details?id=com.maktaba.maariful.quran',\n", + " 'https://play.google.com/store/apps/details?id=com.asantarjuma',\n", + " 'https://play.google.com/store/apps/details?id=tazkeerul.quran',\n", + " 'https://play.google.com/store/apps/details?id=com.anfzquizapp',\n", + " 'https://play.google.com/store/apps/details?id=com.tuheed',\n", + " 'https://isdp.info',\n", + " 'https://isdp.info/students-in-field.php',\n", + " 'https://altasreef.vercel.app',\n", + " 'https://altasreef.vercel.app/exam',\n", + " 'https://aclanthology.org/2025.abjadnlp-1.14.pdf',\n", + " 'https://www.easyquranwahadees.com/',\n", + " 'https://mohaddis.com/',\n", + " 'https://tanzeemdigitallibrary.com/',\n", + " 'https://play.google.com/store/apps/details?id=com.maktaba.maariful.quran',\n", + " 'https://play.google.com/store/apps/details?id=tazkeerul.quran',\n", + " 'https://play.google.com/store/apps/details?id=com.anfzquizapp',\n", + " 'https://play.google.com/store/apps/details?id=com.tuheed',\n", + " 'https://aclanthology.org/2025.abjadnlp-1.14.pdf',\n", + " 'https://link.springer.com/article/10.1007/s10462-022-10313-2',\n", + " 'https://aclanthology.org/2022.osact-1.18/',\n", + " 'https://link.springer.com/chapter/10.1007/978-3-030-22871-2_35',\n", + " 'https://ejournal.um.edu.my/index.php/quranica/article/view/12108',\n", + " 'https://ieeexplore.ieee.org/document/7277250',\n", + " 'https://scholar.google.com/citations?user=AulVnWcAAAAJ&hl=en',\n", + " 'https://altasreef.vercel.app',\n", + " 'mailto:haq@haqnawaz.org',\n", + " 'https://github.com/haqnawaz99',\n", + " 'https://linkedin.com/in/haqnawaz99']" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "ed = Website(\"https://edwarddonner.com\")\n", + "ed = Website(\"https://haqnawaz.org\")\n", "ed.links" ] }, @@ -128,7 +199,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "6957b079-0d96-45f7-a26a-3487510e9b35", "metadata": {}, "outputs": [], @@ -149,17 +220,63 @@ }, { "cell_type": "code", - "execution_count": null, - "id": "b97e4068-97ed-4120-beae-c42105e4d59a", + "execution_count": 6, + "id": "a7f284d7", "metadata": {}, "outputs": [], + "source": [ + "link_system_prompt = (\n", + " \"You are provided with a list of links found on a personal portfolio website. \"\n", + " \"Your task is to identify the links most relevant for inclusion in a personal profile brochure, \"\n", + " \"such as links to About, Projects, AI & NLP, Mobile Apps, Publications, Awards, or Contact sections.\\n\"\n", + " \"Respond in JSON format as shown below:\\n\"\n", + " \"{\\n\"\n", + " ' \"links\": [\\n'\n", + " ' {\"type\": \"about section\", \"url\": \"https://haqnawaz.org#about-me\"},\\n'\n", + " ' {\"type\": \"projects section\", \"url\": \"https://haqnawaz.org#projects\"},\\n'\n", + " ' {\"type\": \"AI & NLP section\", \"url\": \"https://haqnawaz.org#ai-nlp\"},\\n'\n", + " ' {\"type\": \"mobile apps section\", \"url\": \"https://haqnawaz.org#mobile-apps\"},\\n'\n", + " ' {\"type\": \"publications section\", \"url\": \"https://haqnawaz.org#publications\"},\\n'\n", + " ' {\"type\": \"awards section\", \"url\": \"https://haqnawaz.org#awards\"},\\n'\n", + " ' {\"type\": \"contact section\", \"url\": \"https://haqnawaz.org#contact\"}\\n'\n", + " ' ]\\n'\n", + " \"}\"\n", + ")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "b97e4068-97ed-4120-beae-c42105e4d59a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "You are provided with a list of links found on a personal portfolio website. Your task is to identify the links most relevant for inclusion in a personal profile brochure, such as links to About, Projects, AI & NLP, Mobile Apps, Publications, Awards, or Contact sections.\n", + "Respond in JSON format as shown below:\n", + "{\n", + " \"links\": [\n", + " {\"type\": \"about section\", \"url\": \"https://haqnawaz.org#about-me\"},\n", + " {\"type\": \"projects section\", \"url\": \"https://haqnawaz.org#projects\"},\n", + " {\"type\": \"AI & NLP section\", \"url\": \"https://haqnawaz.org#ai-nlp\"},\n", + " {\"type\": \"mobile apps section\", \"url\": \"https://haqnawaz.org#mobile-apps\"},\n", + " {\"type\": \"publications section\", \"url\": \"https://haqnawaz.org#publications\"},\n", + " {\"type\": \"awards section\", \"url\": \"https://haqnawaz.org#awards\"},\n", + " {\"type\": \"contact section\", \"url\": \"https://haqnawaz.org#contact\"}\n", + " ]\n", + "}\n" + ] + } + ], "source": [ "print(link_system_prompt)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "8e1f601b-2eaf-499d-b6b8-c99050c9d6b3", "metadata": {}, "outputs": [], @@ -175,17 +292,79 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "6bcbfa78-6395-4685-b92c-22d592050fd7", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Here is the list of links on the website of https://haqnawaz.org - please decide which of these are relevant web links for a brochure about the company, respond with the full https URL in JSON format. Do not include Terms of Service, Privacy, email links.\n", + "Links (some might be relative links):\n", + "#introduction\n", + "#imam-budair\n", + "#imam-juhany\n", + "#imam-ghamidi\n", + "#isdp\n", + "#altasreef\n", + "#easyquran\n", + "#mohaddis\n", + "#tanzeem\n", + "#ai-nlp-expertise\n", + "#The-Noble-Quran\n", + "#Tazkeer-ul-Quran\n", + "#seerat-quiz\n", + "#tuheed\n", + "#publications\n", + "#brainiac\n", + "#nascon\n", + "#contact\n", + "#introduction\n", + "#contact\n", + "https://jamiaashrafia.org/\n", + "https://ili.digital/\n", + "https://www.easyquranwahadees.com/\n", + "https://tanzeemdigitallibrary.com/\n", + "https://altasreef.vercel.app\n", + "https://play.google.com/store/apps/details?id=com.maktaba.maariful.quran\n", + "https://play.google.com/store/apps/details?id=com.asantarjuma\n", + "https://play.google.com/store/apps/details?id=tazkeerul.quran\n", + "https://play.google.com/store/apps/details?id=com.anfzquizapp\n", + "https://play.google.com/store/apps/details?id=com.tuheed\n", + "https://isdp.info\n", + "https://isdp.info/students-in-field.php\n", + "https://altasreef.vercel.app\n", + "https://altasreef.vercel.app/exam\n", + "https://aclanthology.org/2025.abjadnlp-1.14.pdf\n", + "https://www.easyquranwahadees.com/\n", + "https://mohaddis.com/\n", + "https://tanzeemdigitallibrary.com/\n", + "https://play.google.com/store/apps/details?id=com.maktaba.maariful.quran\n", + "https://play.google.com/store/apps/details?id=tazkeerul.quran\n", + "https://play.google.com/store/apps/details?id=com.anfzquizapp\n", + "https://play.google.com/store/apps/details?id=com.tuheed\n", + "https://aclanthology.org/2025.abjadnlp-1.14.pdf\n", + "https://link.springer.com/article/10.1007/s10462-022-10313-2\n", + "https://aclanthology.org/2022.osact-1.18/\n", + "https://link.springer.com/chapter/10.1007/978-3-030-22871-2_35\n", + "https://ejournal.um.edu.my/index.php/quranica/article/view/12108\n", + "https://ieeexplore.ieee.org/document/7277250\n", + "https://scholar.google.com/citations?user=AulVnWcAAAAJ&hl=en\n", + "https://altasreef.vercel.app\n", + "mailto:haq@haqnawaz.org\n", + "https://github.com/haqnawaz99\n", + "https://linkedin.com/in/haqnawaz99\n" + ] + } + ], "source": [ "print(get_links_user_prompt(ed))" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "a29aca19-ca13-471c-a4b4-5abbfa813f69", "metadata": {}, "outputs": [], @@ -206,10 +385,102 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "74a827a0-2782-4ae5-b210-4a242a8b4cc2", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['/',\n", + " '/models',\n", + " '/datasets',\n", + " '/spaces',\n", + " '/posts',\n", + " '/docs',\n", + " '/enterprise',\n", + " '/pricing',\n", + " '/login',\n", + " '/join',\n", + " '/spaces',\n", + " '/models',\n", + " '/Qwen/Qwen2.5-Omni-7B',\n", + " '/deepseek-ai/DeepSeek-V3-0324',\n", + " '/all-hands/openhands-lm-32b-v0.1',\n", + " '/meta-llama/Llama-4-Scout-17B-16E-Instruct',\n", + " '/openfree/flux-chatgpt-ghibli-lora',\n", + " '/models',\n", + " '/spaces/enzostvs/deepsite',\n", + " '/spaces/jamesliu1217/EasyControl_Ghibli',\n", + " '/spaces/VAST-AI/TripoSG',\n", + " '/spaces/ByteDance/InfiniteYou-FLUX',\n", + " '/spaces/Stable-X/Hi3DGen',\n", + " '/spaces',\n", + " '/datasets/nvidia/Llama-Nemotron-Post-Training-Dataset-v1',\n", + " '/datasets/virtuoussy/Multi-subject-RLVR',\n", + " '/datasets/glaiveai/reasoning-v1-20m',\n", + " '/datasets/open-thoughts/OpenThoughts2-1M',\n", + " '/datasets/FreedomIntelligence/medical-o1-reasoning-SFT',\n", + " '/datasets',\n", + " '/join',\n", + " '/pricing#endpoints',\n", + " '/pricing#spaces',\n", + " '/pricing',\n", + " '/enterprise',\n", + " '/enterprise',\n", + " '/enterprise',\n", + " '/enterprise',\n", + " '/enterprise',\n", + " '/enterprise',\n", + " '/enterprise',\n", + " '/allenai',\n", + " '/facebook',\n", + " '/amazon',\n", + " '/google',\n", + " '/Intel',\n", + " '/microsoft',\n", + " '/grammarly',\n", + " '/Writer',\n", + " '/docs/transformers',\n", + " '/docs/diffusers',\n", + " '/docs/safetensors',\n", + " '/docs/huggingface_hub',\n", + " '/docs/tokenizers',\n", + " '/docs/trl',\n", + " '/docs/transformers.js',\n", + " '/docs/smolagents',\n", + " '/docs/peft',\n", + " '/docs/datasets',\n", + " '/docs/text-generation-inference',\n", + " '/docs/accelerate',\n", + " '/models',\n", + " '/datasets',\n", + " '/spaces',\n", + " '/tasks',\n", + " 'https://ui.endpoints.huggingface.co',\n", + " '/chat',\n", + " '/huggingface',\n", + " '/brand',\n", + " '/terms-of-service',\n", + " '/privacy',\n", + " 'https://apply.workable.com/huggingface/',\n", + " 'mailto:press@huggingface.co',\n", + " '/learn',\n", + " '/docs',\n", + " '/blog',\n", + " 'https://discuss.huggingface.co',\n", + " 'https://status.huggingface.co/',\n", + " 'https://github.com/huggingface',\n", + " 'https://twitter.com/huggingface',\n", + " 'https://www.linkedin.com/company/huggingface/',\n", + " '/join/discord']" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Anthropic has made their site harder to scrape, so I'm using HuggingFace..\n", "\n", @@ -219,10 +490,35 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "d3d583e2-dcc4-40cc-9b28-1e8dbf402924", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "{'links': [{'type': 'home', 'url': 'https://huggingface.co/'},\n", + " {'type': 'models section', 'url': 'https://huggingface.co/models'},\n", + " {'type': 'datasets section', 'url': 'https://huggingface.co/datasets'},\n", + " {'type': 'spaces section', 'url': 'https://huggingface.co/spaces'},\n", + " {'type': 'posts section', 'url': 'https://huggingface.co/posts'},\n", + " {'type': 'documentation', 'url': 'https://huggingface.co/docs'},\n", + " {'type': 'enterprise', 'url': 'https://huggingface.co/enterprise'},\n", + " {'type': 'pricing', 'url': 'https://huggingface.co/pricing'},\n", + " {'type': 'blog', 'url': 'https://huggingface.co/blog'},\n", + " {'type': 'community discussion', 'url': 'https://discuss.huggingface.co'},\n", + " {'type': 'status', 'url': 'https://status.huggingface.co/'},\n", + " {'type': 'GitHub', 'url': 'https://github.com/huggingface'},\n", + " {'type': 'Twitter', 'url': 'https://twitter.com/huggingface'},\n", + " {'type': 'LinkedIn',\n", + " 'url': 'https://www.linkedin.com/company/huggingface/'}]}" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "get_links(\"https://huggingface.co\")" ] @@ -239,7 +535,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "85a5b6e2-e7ef-44a9-bc7f-59ede71037b5", "metadata": {}, "outputs": [], @@ -257,17 +553,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "5099bd14-076d-4745-baf3-dac08d8e5ab2", "metadata": {}, "outputs": [], "source": [ - "print(get_all_details(\"https://huggingface.co\"))" + "# print(get_all_details(\"https://huggingface.co\"))" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "9b863a55-f86c-4e3f-8a79-94e24c1a8cf2", "metadata": {}, "outputs": [], @@ -285,7 +581,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "6ab83d92-d36b-4ce0-8bcc-5bb4c2f8ff23", "metadata": {}, "outputs": [], @@ -303,14 +599,22 @@ "execution_count": null, "id": "cd909e0b-1312-4ce2-a553-821e795d7572", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Found links: {'links': [{'type': 'homepage', 'url': 'https://huggingface.co/'}, {'type': 'models section', 'url': 'https://huggingface.co/models'}, {'type': 'datasets section', 'url': 'https://huggingface.co/datasets'}, {'type': 'spaces section', 'url': 'https://huggingface.co/spaces'}, {'type': 'posts section', 'url': 'https://huggingface.co/posts'}, {'type': 'documentation section', 'url': 'https://huggingface.co/docs'}, {'type': 'enterprise section', 'url': 'https://huggingface.co/enterprise'}, {'type': 'pricing section', 'url': 'https://huggingface.co/pricing'}, {'type': 'blog section', 'url': 'https://huggingface.co/blog'}, {'type': 'discussion forum', 'url': 'https://discuss.huggingface.co'}, {'type': 'GitHub repository', 'url': 'https://github.com/huggingface'}, {'type': 'Twitter profile', 'url': 'https://twitter.com/huggingface'}, {'type': 'LinkedIn profile', 'url': 'https://www.linkedin.com/company/huggingface/'}]}\n" + ] + } + ], "source": [ - "get_brochure_user_prompt(\"HuggingFace\", \"https://huggingface.co\")" + "# get_brochure_user_prompt(\"HuggingFace\", \"https://huggingface.co\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "e44de579-4a1a-4e6a-a510-20ea3e4b8d46", "metadata": {}, "outputs": [], @@ -350,7 +654,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "51db0e49-f261-4137-aabe-92dd601f7725", "metadata": {}, "outputs": [], @@ -375,12 +679,78 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "56bf0ae3-ee9d-4a72-9cd6-edcac67ceb6d", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Found links: {'links': [{'type': 'about section', 'url': 'https://haqnawaz.org#introduction'}, {'type': 'projects section', 'url': 'https://haqnawaz.org#projects'}, {'type': 'AI & NLP section', 'url': 'https://haqnawaz.org#ai-nlp-expertise'}, {'type': 'mobile apps section', 'url': 'https://play.google.com/store/apps/details?id=com.maktaba.maariful.quran'}, {'type': 'mobile apps section', 'url': 'https://play.google.com/store/apps/details?id=tazkeerul.quran'}, {'type': 'mobile apps section', 'url': 'https://play.google.com/store/apps/details?id=com.anfzquizapp'}, {'type': 'mobile apps section', 'url': 'https://play.google.com/store/apps/details?id=com.tuheed'}, {'type': 'publications section', 'url': 'https://aclanthology.org/2025.abjadnlp-1.14.pdf'}, {'type': 'publications section', 'url': 'https://link.springer.com/article/10.1007/s10462-022-10313-2'}, {'type': 'publications section', 'url': 'https://aclanthology.org/2022.osact-1.18/'}, {'type': 'publications section', 'url': 'https://link.springer.com/chapter/10.1007/978-3-030-22871-2_35'}, {'type': 'publications section', 'url': 'https://ejournal.um.edu.my/index.php/quranica/article/view/12108'}, {'type': 'publications section', 'url': 'https://ieeexplore.ieee.org/document/7277250'}, {'type': 'awards section', 'url': 'https://github.com/haqnawaz99'}, {'type': 'contact section', 'url': 'https://haqnawaz.org#contact'}, {'type': 'contact section', 'url': 'https://linkedin.com/in/haqnawaz99'}]}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Some characters could not be decoded, and were replaced with REPLACEMENT CHARACTER.\n" + ] + }, + { + "data": { + "text/markdown": [ + "# HuggingFace Brochure\n", + "\n", + "## Bridging AI & Islamic Scholarship\n", + "\n", + "### About Us\n", + "HuggingFace, spearheaded by *Haq Nawaz*, is at the forefront of merging modern artificial intelligence (AI) with classical Islamic scholarship. With a robust background in Natural Language Processing (NLP), Haq Nawaz is not just a faculty member at Jamia Ashrafia Lahore but is also a dedicated PhD scholar and data science consultant. Our mission is to innovate and digitize Islamic education through award-winning software and applications, enhancing accessibility and engagement with religious texts.\n", + "\n", + "### Our Vision\n", + "We are committed to pioneering efforts in Islamic software development, creating tools that benefit education, research, and broader public outreach. Our projects aim to make classical Islamic literature, the Qur'an, and Hadith easily searchable and interactable, ensuring that this vital knowledge is accessible to everyone.\n", + "\n", + "### Notable Projects\n", + "- **Easy Quran**: An interactive platform that simplifies access to Quranic texts.\n", + "- **Mohaddis**: A tailored solution for Hadith studies.\n", + "- **Tanzeem**: A digital library assembling Islamic references.\n", + "- **Altasreef**: An award-winning platform for Arabic verb conjugation that earned 1st prize at UET Lahore’s Brainiac 2018.\n", + "- **Mobile Applications**:\n", + " - **The Noble Quran**: Offering esteemed translations and tafsir.\n", + " - **Tazkeer Ul Quran**: Multilingual thematic analysis.\n", + " - **Seerat Quiz**: Educational interactive platform for children.\n", + "\n", + "### Recognition\n", + "HuggingFace's contributions have been nationally recognized at events like NaSCon 2019 for innovative research and development in Quranic NLP annotation. We pride ourselves on our role in the wider scholarly community, having hosted discussions with esteemed Islamic leaders regarding the integration of technology and traditional scholarship.\n", + "\n", + "### Company Culture\n", + "At HuggingFace, we foster an environment that encourages collaboration, innovation, and a deep respect for the principles of Islamic scholarship. Our culture thrives on bridging traditional and modern methodologies, promoting continuous learning, and empowering our employees to contribute to meaningful projects that have a tangible impact on society.\n", + "\n", + "### Career Opportunities\n", + "We are always on the lookout for passionate individuals who desire to contribute to the intersection of AI and Islamic scholarship. Our **Intensive Software Development Program (ISDP)** equips recent graduates of Islamic madrasas with essential computer science and software engineering skills, preparing them for rewarding careers in technology.\n", + "\n", + "Join us in our mission to inspire future generations by advancing Islamic knowledge through technology. Together, we can redefine how classical learning is approached in the digital age.\n", + "\n", + "## Get in Touch\n", + "For inquiries related to partnerships, careers, or projects, contact us at:\n", + "- Email: [info@huggingface.com](mailto:info@huggingface.com)\n", + "- Phone: +123-456-7890\n", + "\n", + "### Follow Us\n", + "Stay updated with our latest initiatives and innovations by following us on our social media channels! \n", + "\n", + "Together, let’s bridge the gap between AI and Islamic scholarship." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "stream_brochure(\"HuggingFace\", \"https://huggingface.co\")" + "stream_brochure(\"HuggingFace\", \"https://haqnawaz.org\")" ] }, { @@ -487,7 +857,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "venv", "language": "python", "name": "python3" }, @@ -501,7 +871,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.11" + "version": "3.10.0" } }, "nbformat": 4, diff --git a/week1/week1 EXERCISE.ipynb b/week1/week1 EXERCISE.ipynb index f3486fe..a9d34bc 100644 --- a/week1/week1 EXERCISE.ipynb +++ b/week1/week1 EXERCISE.ipynb @@ -13,17 +13,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "c1070317-3ed9-4659-abe3-828943230e03", "metadata": {}, "outputs": [], "source": [ - "# imports" + "# imports\n", + "\n", + "import os\n", + "import requests\n", + "import json\n", + "from typing import List\n", + "from dotenv import load_dotenv\n", + "from bs4 import BeautifulSoup\n", + "from IPython.display import Markdown, display, update_display\n", + "from openai import OpenAI" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "4a456906-915a-4bfd-bb9d-57e505c5093f", "metadata": {}, "outputs": [], @@ -36,12 +45,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "a8d7923c-5f28-4c30-8556-342d7c8497c1", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "API key found and looks good so far!\n" + ] + } + ], "source": [ - "# set up environment" + "# set up environment\n", + "load_dotenv(override=True)\n", + "api_key = os.getenv('OPENAI_API_KEY')\n", + "\n", + "# Check the key\n", + "\n", + "if not api_key:\n", + " print(\"No API key was found - please head over to the troubleshooting notebook in this folder to identify & fix!\")\n", + "elif not api_key.startswith(\"sk-proj-\"):\n", + " print(\"An API key was found, but it doesn't start sk-proj-; please check you're using the right key - see troubleshooting notebook\")\n", + "elif api_key.strip() != api_key:\n", + " print(\"An API key was found, but it looks like it might have space or tab characters at the start or end - please remove them - see troubleshooting notebook\")\n", + "else:\n", + " print(\"API key found and looks good so far!\")" ] }, { @@ -61,12 +91,77 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "60ce7000-a4a5-4cce-a261-e75ef45063b4", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/markdown": [ + "Certainly! This line of code is using a combination of Python set comprehension and the `yield from` statement. Let's break it down step-by-step:\n", + "\n", + "1. **Set Comprehension**: \n", + " - `{book.get(\"author\") for book in books if book.get(\"author\")}` is a set comprehension. It constructs a set containing the authors from the `books` collection.\n", + " - `books` is assumed to be an iterable, such as a list or tuple, of dictionaries, where each dictionary represents a book with various attributes, including an \"author\".\n", + " - `book.get(\"author\")` attempts to retrieve the value associated with the \"author\" key from each book dictionary.\n", + " - The `if book.get(\"author\")` part ensures that only books with a non-None value for the \"author\" key are included in the set. This helps in filtering out entries where the \"author\" key doesn't exist or is set to `None`.\n", + "\n", + "2. **Yield From**: \n", + " - `yield from` is a statement in Python that delegates part of a generator's operations to another iterable.\n", + " - `yield from` in this context is used to yield each element from the set constructed by the set comprehension one at a time.\n", + "\n", + "3. **Purpose**:\n", + " - The combination of set comprehension and `yield from` results in yielding each distinct author found in the list of books, but importantly, without duplicates, since sets naturally eliminate duplicates.\n", + " - This might be part of a generator function, which is a function allowing iteration over the unique authors.\n", + "\n", + "In summary, this code is used to retrieve and yield each unique author's name from a list of book dictionaries, one by one, eliminating any duplicates. The use of `yield from` makes it efficient for building generators that process data as an iterable sequence." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "# Get gpt-4o-mini to answer, with streaming" + "# Get gpt-4o-mini to answer, with streaming\n", + "from IPython.display import display, Markdown\n", + "import openai\n", + "\n", + "# Your model\n", + "MODEL = \"gpt-4o\" \n", + "# System prompt (sets the assistant's role)\n", + "system_prompt = \"You are a helpful Python expert who explains code clearly and concisely.\"\n", + "\n", + "# The user question\n", + "question = \"\"\"\n", + "Please explain what this code does and why:\n", + "yield from {book.get(\"author\") for book in books if book.get(\"author\")}\n", + "\"\"\"\n", + "\n", + "# Streaming function for explanation\n", + "def stream_code_explanation(code_question):\n", + " stream = openai.chat.completions.create(\n", + " model=MODEL,\n", + " messages=[\n", + " {\"role\": \"system\", \"content\": system_prompt},\n", + " {\"role\": \"user\", \"content\": code_question}\n", + " ],\n", + " stream=True\n", + " )\n", + " \n", + " response = \"\"\n", + " display_handle = display(Markdown(\"\"), display_id=True)\n", + " \n", + " for chunk in stream:\n", + " content = chunk.choices[0].delta.content or \"\"\n", + " response += content\n", + " response_cleaned = response.replace(\"```\", \"\").replace(\"markdown\", \"\")\n", + " display_handle.update(Markdown(response_cleaned))\n", + "\n", + "# Run it!\n", + "stream_code_explanation(question)\n" ] }, { @@ -82,7 +177,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "venv", "language": "python", "name": "python3" }, @@ -96,7 +191,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.11" + "version": "3.10.0rc2" } }, "nbformat": 4,