97 lines
1008 B
Markdown
97 lines
1008 B
Markdown
# Text Analyzer
|
|
|
|
A typed command-line tool for text file analysis.
|
|
|
|
## Requirements
|
|
|
|
- Python 3.12+
|
|
|
|
## Installation
|
|
|
|
Create a virtual environment:
|
|
|
|
```bash
|
|
python3 -m venv .venv
|
|
```
|
|
|
|
Activate it:
|
|
|
|
```bash
|
|
source .venv/bin/activate
|
|
```
|
|
|
|
Install dependencies:
|
|
|
|
```bash
|
|
python -m pip install -r requirements.txt
|
|
```
|
|
|
|
Install the package in editable mode:
|
|
|
|
```bash
|
|
python -m pip install -e .
|
|
```
|
|
|
|
## Usage
|
|
|
|
Basic analysis:
|
|
|
|
```bash
|
|
text-analyzer sample.txt
|
|
```
|
|
|
|
Show the three most frequent words:
|
|
|
|
```bash
|
|
text-analyzer sample.txt --top 3
|
|
```
|
|
|
|
Set minimum word length:
|
|
|
|
```bash
|
|
text-analyzer sample.txt --min-len 4
|
|
```
|
|
|
|
JSON output:
|
|
|
|
```bash
|
|
text-analyzer sample.txt --format json
|
|
```
|
|
|
|
Specify encoding:
|
|
|
|
```bash
|
|
text-analyzer sample.txt --encoding utf-8
|
|
```
|
|
|
|
## Development checks
|
|
|
|
Type checking:
|
|
|
|
```bash
|
|
mypy src
|
|
```
|
|
|
|
Linting:
|
|
|
|
```bash
|
|
ruff check .
|
|
```
|
|
|
|
Formatting:
|
|
|
|
```bash
|
|
ruff format --check .
|
|
```
|
|
|
|
Tests and coverage:
|
|
|
|
```bash
|
|
pytest
|
|
```
|
|
|
|
## Current test results
|
|
|
|
- 15 tests passed
|
|
- Core coverage: 96%
|