Skip to main content

Keyword search tool in .doc documents

Project description

docsearch

docsearch is a lightweight Python command-line tool for searching keywords in .doc and .docx documents within a specified directory. It can display a snippet of text surrounding each keyword occurrence.


Features

  • Search all Word documents in a directory and its subdirectories
  • Display context around each keyword (configurable length)
  • Available as both a command-line tool and Python API
  • Simple installation, cross-platform support (Windows / Linux / macOS)

Installation

Clone the repository and install in editable mode for local development:

git clone https://github.com/yourusername/docsearch.git
cd docsearch
pip install -e .

Command-line Usage

Basic usage:

docsearch <path> <keyword> [-w WINDOW]

Arguments:

Example:

docsearch test Alice -w 50

Example output:

file: test\name1.docx
    1. ...Alice...

Python API Usage (Optional)

You can also use docsearch programmatically:

from docSearch.docfile_processor import docFile

# Initialize
df = docFile(path="test", keyword="Alice")

# Search documents
matches = df.search_keyword_in_path(window=50)

# Display results
df.display_results(matches)

Project Structure

docsearch/
├─ docSearch/             # Package directory   ├─ __init__.py
│   ├─ docfile_processor.py
│   └─ main.py
├─ pyproject.toml
└─ README.md

Dependencies

python-docx >= 0.8.11

License

MIT License

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

docsearchdemo-0.1.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

docsearchdemo-0.1.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file docsearchdemo-0.1.2.tar.gz.

File metadata

  • Download URL: docsearchdemo-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for docsearchdemo-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5bed58fde26592850064880c56f86398d187227d320346ed1c386b802d9132a5
MD5 0375e18ab364fd9015ed776852f646b4
BLAKE2b-256 1c44f2c19c752cb9896b78ed1e285b3adf4f90e900d6de96032ad49789ff9709

See more details on using hashes here.

File details

Details for the file docsearchdemo-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: docsearchdemo-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for docsearchdemo-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e60cdbc19945983aa076f8d8cb199c7f54e2df2180b856dca4269a769ffc3faa
MD5 abd08a6d496b69e8b15a2eeb8d79258a
BLAKE2b-256 486628b39ca34041c32d3dea1a211c6f2788259d87882b7fcc17e243d8b7699c

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