Introduction
In the world of Natural Language Processing (NLP), Question-Answering systems have opened up a multitude of possibilities. From answering trivia to providing medical advice, these systems have found applications in various fields. In this blog post, I’ll walk you through a specialized QA system designed to answer questions using passages of the Bible and Quran.
(Caveat: I asked ChatGPT to write this text from a running chat session where it was helping me build the system.)
Motivation
The Bible and the Quran are some of the most read and studied books in the world. However, understanding its verses and teachings can sometimes require additional context or clarification. This project aims to bridge that gap, providing instant, relevant answers and source documents to your religious-text-related queries.
GitHub Repository
The GitHub repository can be found here: https://github.com/Simibrum/talking_text.
How it Works
Overview
This project is a combination of the Langchain library and a Flask web interface. The Langchain library handles the heavy lifting of text processing, while Flask serves as the user interface.
Components
- Langchain Library: Utilizes text embeddings, vector storage, and question retrieval. It incorporates HuggingFace for embeddings, FAISS for vector storage, and OpenAI for the chat model.
- Flask Web Interface: A straightforward web interface for user interaction, designed with Bootstrap for a polished look.
Flow
- Initialization: Langchain initializes and loads the New Heart English Bible (NHEB) dataset and the Quran dataset.
- User Interaction: Users can enter their questions through the Flask web interface.
- Query Processing: The Flask app sends the query to Langchain, which uses vector storage and an OpenAI model to generate an answer.
- Display Results: The answers, along with source documents, are displayed on the web interface.
Technical Highlights
The project is Dockerized for easy deployment and leverages GPU capabilities for faster text processing. It also uses a cache mechanism to speed up recurring queries.
User Experience
The web interface is designed for simplicity and ease of use. The Bootstrap framework ensures that the interface is responsive and visually appealing. Support for Arabic characters are provided via the Google Noto Sans Arabic font.
Conclusion
This Religious Text QA system is a prime example of how NLP and web technologies can be combined to create a specialized, user-friendly application. It’s a step towards making religious texts more accessible and understandable.
Future Plans
I plan to extend the capabilities of this project by adding more data sources and implementing advanced NLP techniques for better accuracy and context understanding.
I did try to implement this on PythonAnywhere but I soon ran into Disk Quota and RAM limits.

