Metadata-Version: 2.5
Name: lexgrep
Version: 0.6.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# lexgrep

![Lint](https://github.com/jncraton/lexgrep/actions/workflows/lint.yml/badge.svg)
![Test](https://github.com/jncraton/lexgrep/actions/workflows/test.yml/badge.svg)
![PyPI](https://github.com/jncraton/lexgrep/actions/workflows/pypi.yml/badge.svg)

Lexical grep provides fast, index-free search over a variety of file types ordering results by normalized keyword-match score

## Usage

```
lexgrep {query} {files}
```

Query is processed as keywords with support for `-` prefixes for negative keywords.

## Examples

```
> uvx lexgrep "crane rival" sleepy.epub
sleepy.epub Such was the formidable rival with whom Ichabod Crane had to contend, and, considering all things, a stouter man than he would have shrunk from the competition, and a wiser man would have despaired. He had, however, a happy mixture of pliability and perseverance in his nature; he was in form and spirit like a supple-jack-yielding, but tough; though he bent, he never broke; and though he bowed beneath the slightest pressure, yet, the moment it was away-jerk!-he was as erect, and carried his head as high as ever.
...
```

## Benchmark

Return matches for "computer" in 175 ebooks:

- ripgrep-all - 60 seconds
- lexgrep - 1.15 seconds

## Resources

- https://github.com/clips/pattern/blob/master/pattern/text/en/inflect.py
- https://github.com/nizarhabash1/catvar