{"id":48732846,"url":"https://github.com/alwaysvivek/deepgrep","last_synced_at":"2026-05-08T07:34:32.375Z","repository":{"id":320869707,"uuid":"1083611743","full_name":"alwaysvivek/deepgrep","owner":"alwaysvivek","description":"DeepGrep – grep as an API, plus AI-powered semantic search.","archived":false,"fork":false,"pushed_at":"2026-01-22T19:49:05.000Z","size":373,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-12T02:42:01.709Z","etag":null,"topics":["api","css","flask","html5","nlp","postman","python","regex","rest"],"latest_commit_sha":null,"homepage":"https://deepgrep-production.up.railway.app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alwaysvivek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-26T11:36:30.000Z","updated_at":"2026-01-22T19:49:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/alwaysvivek/deepgrep","commit_stats":null,"previous_names":["vivekkdagar/deepgrep","alwaysvivek/deepgrep"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alwaysvivek/deepgrep","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwaysvivek%2Fdeepgrep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwaysvivek%2Fdeepgrep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwaysvivek%2Fdeepgrep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwaysvivek%2Fdeepgrep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alwaysvivek","download_url":"https://codeload.github.com/alwaysvivek/deepgrep/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwaysvivek%2Fdeepgrep/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32771094,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T02:36:36.067Z","status":"ssl_error","status_checked_at":"2026-05-08T02:36:07.210Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","css","flask","html5","nlp","postman","python","regex","rest"],"created_at":"2026-04-12T02:40:50.235Z","updated_at":"2026-05-08T07:34:32.258Z","avatar_url":"https://github.com/alwaysvivek.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔍 DeepGrep\n\n\u003e **Lightning-fast regex meets AI-powered semantic search**  \n\u003e Find exact patterns and contextually relevant matches with intelligent history tracking and REST API integration.\n\n\u003e Railway has a free tier due to which project might not be available by the time you open that link. In that case, refer to the github readme for usage instructions.\n---\n\n## 🛠️ Tech Stack\n\n### Core Development \u0026 Language\n[![Language](https://img.shields.io/badge/Language-Python-3776AB.svg?logo=python\u0026logoColor=white)](https://www.python.org/)\n[![Caching](https://img.shields.io/badge/Caching-functools.lru__cache-blue)](https://docs.python.org/3/library/functools.html)\n[![Data Modeling](https://img.shields.io/badge/Data_Model-Dataclasses-informational)](https://docs.python.org/3/library/dataclasses.html)\n\n### Web Application Stack\n[![Backend Framework](https://img.shields.io/badge/Backend-Flask-000000.svg?logo=flask\u0026logoColor=white)](https://flask.palletsprojects.com/)\n[![CORS Management](https://img.shields.io/badge/CORS-Flask--CORS-5A2C85.svg?logo=flask\u0026logoColor=white)](https://flask-cors.readthedocs.io/en/latest/)\n[![Frontend](https://img.shields.io/badge/Frontend-HTML5%2FCSS3-E34F26.svg?logo=html5\u0026logoColor=white)](https://developer.mozilla.org/en-US/docs/Web/HTML)\n[![JavaScript](https://img.shields.io/badge/Client_Script-JavaScript-F7DF1E.svg?logo=javascript\u0026logoColor=black)](https://developer.mozilla.org/en-US/docs/Web/JavaScript)\n[![Database](https://img.shields.io/badge/Database-SQLite-073159.svg?logo=sqlite\u0026logoColor=white)](https://www.sqlite.org/index.html)\n\n### Search Engines \u0026 NLP\n[![Custom Regex Engine](https://img.shields.io/badge/Engine-Custom_Matcher-CC3333.svg?style=flat\u0026logo=regex\u0026logoColor=white)](https://github.com/alwaysvivek/DeepGrep)\n[![NLP Library](https://img.shields.io/badge/NLP-spaCy-09A3D5.svg?logo=spacy\u0026logoColor=white)](https://spacy.io/)\n[![SpaCy Model](https://img.shields.io/badge/SpaCy_Model-en__core__web__sd-09A3D5.svg)](https://spacy.io/models)\n[![Lexical Data](https://img.shields.io/badge/Lexical_Data-NLTK_WordNet-9B2F2A.svg?logo=nativenscript\u0026logoColor=white)](https://www.nltk.org/howto/wordnet.html)\n\n### Quality \u0026 Tools\n[![Code Quality](https://img.shields.io/badge/Code_Quality-Qodana-orange.svg?logo=jetbrains\u0026logoColor=white)](https://www.jetbrains.com/qodana/)\n[![API Testing](https://img.shields.io/badge/API_Testing-Postman-FF6C37.svg?logo=postman\u0026logoColor=white)](https://www.postman.com/)\n \n### License\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n---\n\n## 📋 Table of Contents\n\n- [Features](#-features)\n- [2026 Tech Trends](#-2026-tech-trends)\n- [Installation](#-installation)\n- [Usage](#-usage)\n- [API Endpoints](#-api-endpoints)\n- [Configuration](#-configuration)\n- [Contributing](#-contributing)\n- [License](#-license)\n\n---\n\n## 🏗️ Architecture\n\nDeepGrep follows a modular architecture with clear separation between the web layer, core search engines, and data persistence:\n\n```mermaid\ngraph TB\n    subgraph \"Client Layer\"\n        User[👤 User]\n        Browser[🌐 Web Browser]\n    end\n    \n    subgraph \"Web Layer\"\n        UI[Web UI\u003cbr/\u003eHTML/CSS/JS + Tailwind]\n        Flask[Flask Application\u003cbr/\u003eRate Limiting + CORS]\n    end\n    \n    subgraph \"Core Search Engines\"\n        RegexEngine[Custom Regex Engine]\n        SemanticEngine[Semantic Search Engine\u003cbr/\u003eSpaCy + NLTK]\n        \n        subgraph \"Regex Components\"\n            Parser[Pattern Parser]\n            Matcher[State-based Matcher\u003cbr/\u003eLRU Cache]\n        end\n    end\n    \n    subgraph \"Data Layer\"\n        HistoryDB[(SQLite Database\u003cbr/\u003eSearch History)]\n        SpacyModel[SpaCy Model\u003cbr/\u003een_core_web_md]\n        WordNet[NLTK WordNet\u003cbr/\u003eAntonym Filtering]\n    end\n    \n    User --\u003e Browser\n    Browser --\u003e UI\n    UI --\u003e Flask\n    \n    Flask --\u003e RegexEngine\n    Flask --\u003e SemanticEngine\n    Flask --\u003e HistoryDB\n    \n    RegexEngine --\u003e Parser\n    Parser --\u003e Matcher\n    \n    SemanticEngine --\u003e SpacyModel\n    SemanticEngine --\u003e WordNet\n    \n    style User fill:#e1f5ff\n    style Flask fill:#ffd6e0\n    style RegexEngine fill:#fff4cc\n    style SemanticEngine fill:#d4f1d4\n    style HistoryDB fill:#e8d5f2\n```\n\n### Component Overview\n\n- **Web UI**: Interactive interface with dual search modes (regex/semantic), built with Tailwind CSS\n- **Flask Application**: REST API with rate limiting, CORS support, and comprehensive logging\n- **Custom Regex Engine**: From-scratch implementation supporting complex patterns, quantifiers, and capture groups\n- **Semantic Search Engine**: AI-powered similarity matching using word embeddings and POS filtering\n- **Search History**: Persistent SQLite database tracking all searches with timestamps and analytics\n\n---\n\n## 🚀 Features\n\nDeepGrep combines a high-performance custom regex engine with AI-powered semantic search, backed by persistent history tracking. Key features include:\n\n### 🔍 Custom Regex Engine\n- **Full Regex Support**: Implements a complete regex matcher from scratch, supporting literals, character classes (`\\d`, `\\w`, `[abc]`), quantifiers (`*`, `+`, `?`, `{n,m}`), alternations (`|`), anchors (`^`, `$`), capture groups, and backreferences.\n- **Efficient Matching**: Uses state-based matching with caching for compiled patterns to ensure fast performance on large texts.\n- **Line-by-Line Processing**: Optimized for searching through multi-line text inputs.\n\n### 🧠 Semantic Search\n- **AI-Powered Similarity**: Leverages SpaCy NLP models to find semantically related words based on vector similarity.\n- **Antonym Avoidance**: Integrates WordNet to exclude antonyms and irrelevant matches.\n- **POS Filtering**: Filters results by part-of-speech (e.g., adjectives, verbs) for more accurate contextual matches.\n- **Configurable Thresholds**: Adjustable similarity thresholds and top-N results for fine-tuned searches.\n\n### 📊 Search History \u0026 Analytics\n- **Persistent Logging**: SQLite-backed database to log all searches with timestamps, match counts, and file sources.\n- **History Queries**: Retrieve recent searches, top-used patterns, or export/import history to/from JSON.\n- **Automatic Cleanup**: Maintains a maximum history size to prevent database bloat.\n\n### 🌐 Web Interface \u0026 API\n- **Flask Web App**: Simple HTML/CSS/JS frontend for interactive searches.\n- **REST API**: Endpoints for regex and semantic searches, with JSON responses.\n- **Rate Limiting**: Configurable request limits to prevent abuse.\n- **CORS Support**: Cross-origin requests enabled for integration.\n- **Logging**: Comprehensive logging for debugging and monitoring.\n\n### 🐳 Containerization \u0026 Deployment\n- **Docker Support**: Dockerfile for easy containerization and deployment.\n- **Environment Configuration**: Uses `python-decouple` for secure, environment-based config (e.g., via `.env` files).\n- **Production Ready**: Includes lazy initialization, error handling, and scalable architecture.\n\n### 🧪 Testing \u0026 Quality\n- **Unit Tests**: Test suite in the `tests/` directory for core functionality.\n- **Code Quality**: Integrated with Qodana for static analysis.\n- **API Testing**: Postman collections for endpoint validation.\n\n---\n\n## ⚡ Performance\n\nDeepGrep is optimized for low resource environments while maintaining high throughput:\n\n| Metric | Result | Context |\n|--------|--------|---------|\n| **Regex Throughput** | ~85 lines/sec | Complex patterns on random text |\n| **Memory Footprint** | \u003c 1MB | Peak memory during heavy regex matching |\n| **History DB Write** | ~675 ops/sec | SQLite write performance |\n\n*Benchmarks run on Python 3.14 on macOS.*\n\n---\n\n## 📦 Installation\n\n**Clone the repository**:\n   ```bash\n   git clone https://github.com/alwaysvivek/deepgrep.git\n   cd deepgrep\n   ```\n   \n**Install dependencies**\n\n    pip install -r requirements.txt\n\n### Download SpaCy model\n    python -m spacy download en_core_web_md\n    \n### Set up environment (optional)\nCopy `.env.example` to `.env` and configure as needed.\n\n### Run the app\n    python -m deepgrep.web.app\n\n### Or using Docker\n\n    docker build -t deepgrep .\n    docker run -p 8000:8000 deepgrep\n\n---\n\n## 💡 Usage\n\n### Web Interface\n\nOpen http://localhost:8000 in your browser.  \nEnter text and patterns for regex search or keywords for semantic search.\n\n### API Usage\n\nUse tools like curl or Postman to interact with the API.\n\n#### Regex Search\n\n    curl -X POST http://localhost:8000/search \\\n      -H \"Content-Type: application/json\" \\\n      -d '{\"pattern\": \"hello.*world\", \"text\": \"hello beautiful world\"}'\n\n#### Semantic Search\n\n    curl -X POST http://localhost:8000/semantic \\\n      -H \"Content-Type: application/json\" \\\n      -d '{\"keyword\": \"happy\", \"text\": \"I am joyful and content.\"}'\n\n---\n\n## 🔗 API Endpoints\n\n### GET /\n\nServes the home page.\n\n### POST /search\n\nPerforms regex search.\n\nRequest body:\n\n    {\n      \"pattern\": \"string\",\n      \"text\": \"string\"\n    }\n\nResponse:\n\n    {\n      \"matches\": [],\n      \"history\": []\n    }\n\n### POST /semantic\n\nPerforms semantic search.\n\nRequest body:\n\n    {\n      \"keyword\": \"string\",\n      \"text\": \"string\"\n    }\n\nResponse:\n\n    {\n      \"matches\": [[\"word\", score]]\n    }\n\n---\n\n## ⚙️ Configuration\n\nConfigure via environment variables (or `.env` file):\n\n    PORT=8000\n    DEBUG=True\n    HOST=0.0.0.0\n\n    RATE_LIMIT_ENABLED=True\n    RATE_LIMIT_REQUESTS=100\n\n    DB_PATH=~/.grepify_history.db\n    MAX_HISTORY=200\n\n    SPACY_MODEL=en_core_web_md\n    SEMANTIC_THRESHOLD=0.45\n    SEMANTIC_TOP_N=10\n\n---\n\n## 🤝 Contributing\n\nContributions are welcome!\n\n- Fork the repo\n- Create a feature branch\n- Add tests for new features\n- Ensure code passes Qodana checks\n- Submit a pull request\n\n---\n\n## 📄 License\n\nThis project is licensed under the MIT License.  \nSee the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falwaysvivek%2Fdeepgrep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falwaysvivek%2Fdeepgrep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falwaysvivek%2Fdeepgrep/lists"}