Skip to main content

A lightweight AI assistant with Arabic language support for mobile and offline use

Project description

🤖 المفتي بن بدران - Almufti Bin Badran

A Lightweight AI Assistant with Arabic Language Support

GitHub Hugging Face PyPI License Python


📖 جدول المحتويات | Table of Contents


✨ المميزات | Features

🧠 محادثة ذكية | Smart Chat

  • دعم اللغة العربية والإنجليزية - Full Arabic & English support
  • فهم السياق - Context awareness across conversations
  • حفظ المحادثات - Persistent conversation history
  • استرجاع المحادثات - Retrieve previous conversations
  • تحليل المشاعر - Sentiment analysis

🔍 بحث ذكي | Intelligent Search

  • بحث عام على الإنترنت - General web search
  • بحث أكاديمي - Academic search
  • استخراج المحتوى - Content extraction
  • تلخيص النتائج - Result summarization
  • معالجة الروابط - Link processing

🧮 حل المسائل | Problem Solving

  • معادلات خطية وتربيعية - Linear & quadratic equations
  • مسائل هندسية - Geometric problems
  • حساب النسب المئوية - Percentage calculations
  • شرح الخطوات - Step-by-step explanations
  • التحقق من الحلول - Solution verification

📚 معالجة اللغة الطبيعية | NLP

  • كشف اللغة التلقائي - Automatic language detection
  • استخراج الكلمات المفتاحية - Keyword extraction
  • استخراج الكيانات - Named entity recognition
  • حساب التشابه - Similarity computation
  • تحليل النصوص - Text analysis

🧠 التعلم المستمر | Continuous Learning

  • تسجيل التفاعلات - Interaction logging
  • تحليل الملاحظات - Feedback analysis
  • تقارير الأداء - Performance reports
  • توصيات التحسن - Improvement suggestions
  • التطور الذاتي - Self-improvement

💾 إدارة البيانات | Data Management

  • قاعدة بيانات SQLite - SQLite database
  • نسخ احتياطية تلقائية - Automatic backups
  • حفظ المعرفة - Knowledge persistence
  • استرجاع سريع - Fast retrieval
  • تشفير البيانات - Data encryption

🔧 المتطلبات | Requirements

الحد الأدنى للنظام | Minimum System Requirements

  • Python: 3.8 أو أحدث | Python 3.8+
  • الذاكرة: 512 MB على الأقل | 512 MB RAM minimum
  • المساحة: 100 MB على الأقل | 100 MB disk space
  • الإنترنت: اختياري (للبحث فقط) | Optional (search only)

المكتبات المطلوبة | Required Libraries

requests>=2.28.0
beautifulsoup4>=4.11.0
nltk>=3.8.0
scikit-learn>=1.1.0
gradio>=4.0.0

📥 التثبيت | Installation

1. التثبيت من PyPI (الطريقة الموصى بها)

pip install almufti-bin-badran

2. التثبيت من المصدر

# استنساخ المستودع
git clone https://github.com/s200077761/almufti-bin-badran.git
cd almufti-bin-badran

# تثبيت المتطلبات
pip install -r requirements.txt

# تثبيت المشروع
pip install -e .

3. التثبيت باستخدام Docker

# بناء الصورة
docker build -t almufti-bin-badran:latest .

# تشغيل الحاوية
docker run -p 7860:7860 almufti-bin-badran:latest

4. التثبيت على Hugging Face Spaces

اذهب إلى: https://huggingface.co/spaces/s200077761/almufti-bin-badran

🚀 الاستخدام | Usage

استخدام واجهة سطر الأوامر | CLI Usage

from almufti import ChatEngine

# إنشاء محرك المحادثة
chat = ChatEngine()

# محادثة بسيطة
response = chat.chat("السلام عليكم، كيف حالك؟")
print(response)

# مع البحث على الإنترنت
response = chat.chat("ما هي أحدث أخبار التكنولوجيا؟", search=True)
print(response)

# حل مسألة رياضية
response = chat.chat("حل المعادلة: x^2 + 5x + 6 = 0")
print(response)

استخدام واجهة Gradio | Gradio Interface

python app.py

ثم اذهب إلى: http://localhost:7860

استخدام API البرمجية | Python API

from almufti.core import LanguageProcessor, ChatEngine
from almufti.search import WebSearch
from almufti.homework import MathSolver
from almufti.learning import ContinuousLearning
from almufti.database import DatabaseManager

# معالج اللغة
lp = LanguageProcessor()
language = lp.detect_language("مرحبا بك")
keywords = lp.extract_keywords("هذا نص عربي مهم جداً")

# البحث الذكي
search = WebSearch()
results = search.search("Python programming")
summary = search.summarize_results(results)

# حل المسائل الرياضية
solver = MathSolver()
solution = solver.solve_quadratic(1, 5, 6)

# التعلم المستمر
learning = ContinuousLearning()
learning.log_interaction("user_query", "bot_response", "positive")
report = learning.generate_report()

# إدارة البيانات
db = DatabaseManager()
db.save_conversation("user_id", "conversation_text")
history = db.get_conversation_history("user_id")

💡 الأمثلة | Examples

مثال 1: محادثة بسيطة

from almufti import ChatEngine

chat = ChatEngine()

# محادثة عادية
response = chat.chat("ما هو الذكاء الاصطناعي؟")
print(response)
# Output: الذكاء الاصطناعي هو فرع من فروع علوم الحاسوب...

مثال 2: بحث على الإنترنت

from almufti import ChatEngine

chat = ChatEngine()

# بحث عن معلومات
response = chat.chat("أخبرني عن أحدث تطورات في الذكاء الاصطناعي", search=True)
print(response)

مثال 3: حل مسائل رياضية

from almufti.homework import MathSolver

solver = MathSolver()

# حل معادلة تربيعية
solution = solver.solve_quadratic(1, -5, 6)
print(f"الحل: {solution}")
# Output: الحل: [2, 3]

# حل معادلة خطية
solution = solver.solve_linear(2, 4)
print(f"الحل: {solution}")
# Output: الحل: -2

مثال 4: تحليل النصوص

from almufti.core import LanguageProcessor

lp = LanguageProcessor()

# كشف اللغة
text = "Hello, how are you?"
language = lp.detect_language(text)
print(f"اللغة: {language}")
# Output: اللغة: en

# استخراج الكلمات المفتاحية
text = "الذكاء الاصطناعي والتعلم الآلي هما مستقبل التكنولوجيا"
keywords = lp.extract_keywords(text)
print(f"الكلمات المفتاحية: {keywords}")

مثال 5: التعلم المستمر

from almufti.learning import ContinuousLearning

learning = ContinuousLearning()

# تسجيل تفاعل إيجابي
learning.log_interaction(
    user_query="ما هو Python؟",
    bot_response="Python هي لغة برمجة...",
    feedback="positive"
)

# الحصول على تقرير الأداء
report = learning.generate_report()
print(report)

🏗️ البنية | Architecture

هيكل المشروع

almufti-bin-badran/
├── almufti/                    # المكتبة الرئيسية
│   ├── __init__.py
│   ├── cli.py                 # واجهة سطر الأوامر
│   ├── core/                  # المكونات الأساسية
│   │   ├── chat_engine.py     # محرك المحادثة
│   │   └── language_processor.py  # معالج اللغة
│   ├── search/                # البحث الذكي
│   │   └── web_search.py      # البحث على الإنترنت
│   ├── homework/              # حل الواجبات
│   │   └── math_solver.py     # حل المسائل الرياضية
│   ├── learning/              # التعلم المستمر
│   │   └── continuous_learning.py
│   └── database/              # إدارة البيانات
│       └── db_manager.py      # مدير قاعدة البيانات
├── config/                    # الإعدادات
│   └── settings.yaml
├── data/                      # البيانات
│   ├── conversations/
│   ├── knowledge/
│   └── models/
├── examples/                  # الأمثلة
│   └── basic_usage.py
├── tests/                     # الاختبارات
│   └── test_basic.py
├── app.py                     # تطبيق Gradio
├── requirements.txt           # المكتبات المطلوبة
├── setup.py                   # إعداد الحزمة
├── Dockerfile                 # ملف Docker
├── docker-compose.yml         # Docker Compose
└── README.md                  # هذا الملف

مخطط المكونات

┌─────────────────────────────────────────┐
│         User Interface Layer            │
│  (CLI, Gradio, API)                     │
└──────────────────┬──────────────────────┘
                   │
┌──────────────────▼──────────────────────┐
│      Chat Engine (Core Logic)           │
│  - Context Management                   │
│  - Response Generation                  │
└──────────────────┬──────────────────────┘
                   │
        ┌──────────┼──────────┐
        │          │          │
┌───────▼──┐ ┌────▼────┐ ┌──▼──────┐
│ Language │ │  Search │ │ Problem │
│Processor │ │ Engine  │ │ Solver  │
└───────┬──┘ └────┬────┘ └──┬──────┘
        │         │         │
        └─────────┼─────────┘
                  │
        ┌─────────▼────────┐
        │ Database Manager │
        │ (SQLite)         │
        └──────────────────┘

🤝 المساهمة | Contributing

نرحب بمساهماتك! يرجى اتباع الخطوات التالية:

خطوات المساهمة

  1. استنساخ المستودع
git clone https://github.com/s200077761/almufti-bin-badran.git
cd almufti-bin-badran
  1. إنشاء فرع جديد
git checkout -b feature/your-feature-name
  1. إجراء التغييرات
# قم بإجراء التغييرات المطلوبة
# تأكد من اتباع معايير الكود
  1. اختبار التغييرات
python -m pytest tests/
  1. إرسال Pull Request
git add .
git commit -m "Add your feature description"
git push origin feature/your-feature-name

معايير الكود | Code Standards

  • استخدم PEP 8 لتنسيق الكود
  • أضف docstrings لكل دالة
  • اكتب unit tests للميزات الجديدة
  • تأكد من أن جميع الاختبارات تمر
  • أضف comments للكود المعقد

قائمة التحقق | Checklist

  • الكود يتبع معايير PEP 8
  • تمت إضافة docstrings
  • تم كتابة الاختبارات
  • جميع الاختبارات تمر
  • تم تحديث الوثائق
  • تم إضافة أمثلة إن لزم الأمر

📋 متطلبات التطوير | Development Requirements

# تثبيت متطلبات التطوير
pip install -r requirements-dev.txt

# التي تتضمن:
# - pytest (للاختبارات)
# - black (لتنسيق الكود)
# - flake8 (للتحقق من الكود)
# - mypy (للتحقق من الأنواع)

🧪 الاختبارات | Testing

تشغيل الاختبارات

# تشغيل جميع الاختبارات
pytest

# تشغيل اختبارات محددة
pytest tests/test_basic.py

# مع تقرير التغطية
pytest --cov=almufti tests/

مثال على اختبار

import pytest
from almufti import ChatEngine

def test_chat_response():
    chat = ChatEngine()
    response = chat.chat("مرحبا")
    assert response is not None
    assert isinstance(response, str)

🐛 الإبلاغ عن الأخطاء | Bug Reports

إذا وجدت خطأ، يرجى:

  1. تحقق من أنه لم يتم الإبلاغ عنه بالفعل
  2. أنشئ issue جديد مع:
    • وصف واضح للمشكلة
    • خطوات لإعادة إنتاج المشكلة
    • النتيجة المتوقعة والفعلية
    • معلومات النظام (Python version, OS, etc.)

📚 الوثائق الإضافية | Additional Documentation


📄 الترخيص | License

هذا المشروع مرخص تحت رخصة MIT - انظر ملف LICENSE للتفاصيل.

MIT License

Copyright (c) 2024 Almufti Bin Badran

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

📞 التواصل | Contact


🙏 شكر خاص | Special Thanks

شكر خاص لـ:

  • مجتمع Python العربي
  • مجتمع الذكاء الاصطناعي
  • جميع المساهمين والداعمين

📊 الإحصائيات | Statistics

GitHub Stars GitHub Forks GitHub Issues GitHub Pull Requests


🗺️ خارطة الطريق | Roadmap

الإصدار 1.1.0 (قريباً)

  • دعم الصوت
  • تحسين سرعة البحث
  • إضافة المزيد من اللغات
  • تحسين واجهة Gradio

الإصدار 1.2.0

  • دعم الصور
  • نموذج تعلم عميق مخصص
  • API متقدمة
  • تطبيق موبايل

الإصدار 2.0.0

  • دعم متعدد المستخدمين
  • نظام توصيات متقدم
  • تكامل مع خدمات خارجية
  • لوحة تحكم إدارية

📝 ملاحظات | Notes

  • هذا المشروع قيد التطوير المستمر
  • الميزات قد تتغير في الإصدارات المستقبلية
  • نرحب بالملاحظات والاقتراحات
  • يرجى الإبلاغ عن أي أخطاء

🎯 الأهداف | Goals

✅ توفير مساعد ذكي خفيف الوزن
✅ دعم كامل للغة العربية
✅ سهولة الاستخدام والتثبيت
✅ وثائق شاملة وسهلة الفهم
✅ مجتمع نشط وداعم
✅ تطوير مستمر وتحسينات دورية


شكراً لاستخدامك المفتي بن بدران! 🙏

Made with ❤️ for the Arabic AI Community

آخر تحديث: 2024-12-04
الإصدار: 1.0.0
الحالة: ✅ مكتمل بنجاح

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

almufti_bin_badran-1.0.0.tar.gz (32.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

almufti_bin_badran-1.0.0-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file almufti_bin_badran-1.0.0.tar.gz.

File metadata

  • Download URL: almufti_bin_badran-1.0.0.tar.gz
  • Upload date:
  • Size: 32.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for almufti_bin_badran-1.0.0.tar.gz
Algorithm Hash digest
SHA256 be1d5915ad385344bce8d8e9a2d04a76f0ba012337581d66e6272c18de7fdfea
MD5 a52bde89c066815c22017565e49ffb0a
BLAKE2b-256 882cebb25890352e21138da4b7f6a150c5a741528d08603869ea8fdb1ced130b

See more details on using hashes here.

File details

Details for the file almufti_bin_badran-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for almufti_bin_badran-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8a3a56288c0fd52c0b98fbdd92b5de69e9bcc5c4c7f57379d79d1de2052387c
MD5 069427adcd7d18127b60452763d7c0f1
BLAKE2b-256 42c720476b855a7026accbda72d76124e1e2e93abd18c81479547393cd9ca494

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page