https://github.com/benorbiato/dictionary-search
A Python project demonstrating data structures, concurrency, and API design for searching words efficiently.
https://github.com/benorbiato/dictionary-search
fastapi pydantic python uvicorn
Last synced: about 1 month ago
JSON representation
A Python project demonstrating data structures, concurrency, and API design for searching words efficiently.
- Host: GitHub
- URL: https://github.com/benorbiato/dictionary-search
- Owner: benorbiato
- License: mit
- Created: 2025-10-03T11:35:26.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-10-03T12:55:43.000Z (9 months ago)
- Last Synced: 2025-10-03T13:28:57.743Z (9 months ago)
- Topics: fastapi, pydantic, python, uvicorn
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dictionary Search
**Dictionary Search** is a Python project demonstrating efficient word searches using linear and hash-based methods, along with concurrency and a RESTful API.
## Key Features
* **RESTful API**: FastAPI endpoints to list, search, and add words.
* **Concurrency**: Parallel word search using threads and locks.
* **Performance**: Compare sequential vs concurrent execution times.
## Project Structure
```
dictionary-search/
│
├── data/
│ └── dictionary.json # Word list in JSON
│
├── src/
│ ├── search.py # Linear and hash search functions
│ ├── dictionary_loader.py # Loads dictionary from JSON
│ ├── api_design.py # FastAPI implementation
│ └── concurrency_demo.py # Parallel search and performance demo
│
└── requirements.txt # Dependencies
```
## Quick Start
1. Clone the repository:
```bash
git clone https://github.com/your-username/dictionary-search.git
cd dictionary-search
```
2. Create and activate a virtual environment:
```bash
python3 -m venv venv
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windows
```
3. Install dependencies:
```bash
pip install -r requirements.txt
```
## Usage
### Run the API
```bash
uvicorn src.api_design:app --reload
```
* Access API at `http://127.0.0.1:8000`
* Interactive docs: `http://127.0.0.1:8000/docs`
### Run Concurrency Demo
```bash
python src/concurrency_demo.py
```
* Measures execution time for linear vs hash searches, sequential vs concurrent.
## Big O Complexity
| Method | Time Complexity |
| ------------- | --------------- |
| Linear Search | O(n) |
| Hash Search | O(1) average |
| Adding Word | O(1) |