Coder Social home page Coder Social logo

utrodus / fastapi-ayatnesia Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 28.15 MB

Rest API built with Python and the FastAPI Framework for searching Koranic verse texts with Indonesian language queries using lexical and semantic similarity measurements

Python 43.63% Dockerfile 0.30% CSS 15.31% HTML 40.76%
fastapi python quran-api quran-search quran-search-engine

fastapi-ayatnesia's Introduction

Quran Finder - API

This final year project focuses on searching Quranic verses using lexical, semantic, and combined approaches.

Table of Contents:

Description

The Quran Search API allows you to search for text using various measures such as lexical, semantic, and lexical semantic.

It provides an efficient way to access and retrieve information from the Quran.

In this project, we used two exciting methods: one for measuring lexical similarity and another for gauging semantic similarity. In the application, users have the flexibility to opt for either of these methods independently or harness the power of both in combination.

For measuring Lexical Similarity the methods used are TF-IDF and Cosine similarity.

  1. TF-IDF: TF-IDF is used to evaluate the importance of words in the translation of the Qur'an. TF-IDF is a method used to evaluate the importance of a word in a document or text. This is done by calculating how often the word appears in the document (Term Frequency) and the extent to which the word is unique across documents (Inverse Document Frequency).

  2. Cosine similarity is a method used to measure the degree to which two vectors (in this case, vector representations of words) are in lexical relationship to each other. In the context of Ayatnesia, cosine similarity is used to compare the TF-IDF vector between the verses of the Qur'an and the keyword. The higher the cosine similarity value between the verse and the keyword, the more lexically similar the two things are.

While to measure Semantic Similarity in Ayatnesia when searching for verses in the Qur'an, the method used is Word Embedding with FastText. This method involves representing words as high-dimensional vectors in a semantic space using FastText, a powerful word embedding tool.

These vector representations capture the semantic meanings of words, allowing Ayatnesia to compare and measure the similarity between verses in the Qur'an based on their semantic content. By utilizing Word Embedding with FastText, Ayatnesia enables users to find verses with similar semantic meanings, enhancing the effectiveness of verse searches and facilitating a deeper understanding of the Qur'an.

The API empowers you with these features to enhance your search capabilities and facilitate a comprehensive analysis of the Quran. ๐Ÿš€

Features

๐Ÿ’Ž Key Features:

  • Get all Qur'an Surahs
  • Get detailed information about a specific Quran Surah
  • Search using lexical measures
  • Search using semantic measures
  • Search using lexical semantic measures

Requirements:

  • Python >= 3

Installation

  1. Clone or download de repository:
$ git clone https://github.com/utrodus/fastapi-quran-finder.git
  1. Open the console inside the project directory and create a virtual environment (You can skip this step if you have docker installed).
$ python -m venv venv
$ source venv/Scripts/activate
  1. Install the app
(venv) $ pip install -r requirements.txt

Run it locally

$ uvicorn main:app --reload

install required data nltk library

$ python src/setup_nltk.py

Basic Usage

first off all, run preprocessing quran data for preprocessing ayahs for each surahs

$ python src/preprocessing/quran_preprocessing.py

Deployment ๐Ÿš€

Build docker images

This command will build a Docker image named "ayatnesia" using the Dockerfile in the current directory. The -t option assigns a tag (name) to the image.

$ docker build -t ayatnesia .

Save docker image as a tar file

Run the following command to save the Docker image as a tar file:

$ docker save ayatnesia -o ayatnesia.tar

Run the FastAPI application using Docker:

Start a Docker container using the following command:

$ docker run -d --name ayatnesia-container -p 3100:3100 ayatnesia

Once you are running the server open the Swagger UI App to checkout the API documentation.

fastapi-ayatnesia's People

Contributors

utrodus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.