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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docsearchdemo-0.1.1.tar.gz.
File metadata
- Download URL: docsearchdemo-0.1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf3ea8c7cc268b432f3b8c66ea5e48f1548de87318719dd1deb4f7f104b2e957
|
|
| MD5 |
28211d1eaa746da498185c1b0d5e3f2b
|
|
| BLAKE2b-256 |
2b924814b360923ac04e20befb50bf53fc9ce9f1c7f9968db498c28008acd1eb
|
File details
Details for the file docsearchdemo-0.1.1-py3-none-any.whl.
File metadata
- Download URL: docsearchdemo-0.1.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef385221efdf58f8f250e5e4795b06041f1172e2a4013e82d2bb9b0823d16c2f
|
|
| MD5 |
47a81a614b6fe49915512c3182cc5b2d
|
|
| BLAKE2b-256 |
656bedb3ab15c528c62439c510113f7e9b2315f8827591af2c4540043dcfa633
|