Skip to content

a simple command-line tool that allows you to query possible Arabic words off a random string from a pre-built JSON dictionary.

Notifications You must be signed in to change notification settings

AlafariAbdullah/WordRecognize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🧠 WordRecognize — Arabic Word Query Tool

📄 Overview

Query.py is a simple command-line tool that allows you to query possible Arabic words off a random string from a pre-built JSON dictionary.
I generated one myself using this wordlist — special thanks to Jamal for providing it.

It helps identify possible Arabic words that can be formed from a given set of letters, which makes it useful for recognizing words that share the same root structure or letter order.


⚙️ Requirements

  • Python 3.8+
  • A valid dictionary file named Dictionary.json in the same directory.

Example Dictionary.json:

{
  "اخدعهي": [
    "أخدعيه",
    "يخادعه",
    "يخدعها"
  ],
}

🚀 Usage

Basic Query

python3 Query.py دخاعهي

Output:

['أخدعيه', 'يخادعه', 'يخدعها']

Multiple Queries

You can check multiple words at once:

python3 Query.py دخاعهي بعاللهد اغغغغغ

Output:

['أخدعيه', 'يخادعه', 'يخدعها']
['عبدالله']
اغغغغغ doesn't appear in the database

Interactive Mode (no arguments)

If you run it without any arguments:

python3 Query.py

It will prompt you:

you need to enter at least one argument
Hint: Expected
Query.py <word1> , <word2>...
Example:
Query.py احمد
Query.py حامد احمد محمد

🧩 How It Works

  1. Normalization
    Converts Aleph variants (آ, أ, إ) → ا.
    Example: إحمداحمد

  2. Key Generation
    Sorts the word’s letters alphabetically to form a lookup key.
    Example:

    • "احمد" → "احدم"
    • "حامد" → "احدم"
      → both share the same key, so they’re recognized as related.
  3. Dictionary Lookup
    Loads Dictionary.json once, searches for each key, and prints the results.


🛠 Future Improvements

  • Add --no-normalize flag to disable Aleph normalization.
  • Add normalization for ة to ة.
  • Add an option to save missing words for review.
  • Combine SetDictionary.py & Query.py into one program.

📂 Project Structure

WordRecognize/
├── Query.py
├── ArabicWordsList.txt
├── Dictionary.json
└── README.md

...

I am a Computer Science sophomore at Prince Sultan University (PSU). If you’re interested, feel free to connect with me on Linkedin or visit my website

About

a simple command-line tool that allows you to query possible Arabic words off a random string from a pre-built JSON dictionary.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages