MCPcopy Index your code
hub / github.com/ad-si/Textalyzer

github.com/ad-si/Textalyzer @textalyzer-v0.5.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release textalyzer-v0.5.0 ↗ · + Follow
49 symbols 117 edges 11 files 15 documented · 31% updated 48d agotextalyzer-v0.4.0 · 2025-06-16★ 598 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Textalyzer

Analyze key metrics like number of words, readability, complexity, etc. of any kind of text.

CLI Web
CLI Screenshot Web Screenshot

Usage

# Word frequency histogram
textalyzer histogram <filepath>

# Find duplicated code blocks (default: minimum 3 non-empty lines)
textalyzer duplication <path> [<additional paths...>]

# Find duplications with at least 5 non-empty lines
textalyzer duplication --min-lines=5 <path> [<additional paths...>]

# Include single-line duplications
textalyzer duplication --min-lines=1 <path> [<additional paths...>]

# Output duplications as JSON
textalyzer duplication --json <path> [<additional paths...>]

Example JSON output:

[{
  "content": "<duplicated text block>",
  "locations": [
    { "path": "file1.txt", "line": 12 },
    { "path": "file2.txt", "line": 34 }
  ]
}, {
  "content": "<another duplicated block>",
  "locations": [
    { "path": "file1.txt", "line": 56 },
    { "path": "file3.txt", "line": 78 }
  ]
}]

The duplication command analyzes files for duplicated text blocks. It can: - Analyze multiple files or recursively scan directories - Filter duplications based on minimum number of non-empty lines with --min-lines=N (default: 2) - Detect single-line duplications when using --min-lines=1 - Rank duplications by number of consecutive lines - Show all occurrences with file and line references - Utilize multithreaded processing for optimal performance on all available CPU cores - Use memory mapping for efficient processing of large files with minimal memory overhead - Output duplication data as JSON with --json

Related

  • jscpd - Copy/paste detector for programming source code.
  • megalinter - Code quality and linter tool.
  • pmd - Source code analysis tool.
  • qlty - Code quality and security analysis tool.
  • superdiff - Find duplicate code blocks in files.
  • wf - Command line utility for counting word frequency.

Rewrite in Rust

This CLI tool was originally written in JavaScript and was later rewritten in Rust to improve the performance.

Before:

hyperfine --warmup 3 'time ./cli/index.js examples/1984.txt'
Benchmark #1: time ./cli/index.js examples/1984.txt
  Time (mean ± σ):     390.3 ms ±  15.6 ms    [User: 402.6 ms, System: 63.5 ms]
  Range (min … max):   366.7 ms … 425.7 ms

After:

hyperfine --warmup 3 'textalyzer histogram examples/1984.txt'
Benchmark #1: textalyzer histogram examples/1984.txt
  Time (mean ± σ):      40.4 ms ±   2.5 ms    [User: 36.0 ms, System: 2.7 ms]
  Range (min … max):    36.9 ms …  48.7 ms

Pretty impressive 10x performance improvement! 😁

Core symbols most depended-on inside this repo

to_string
called by 32
textalyzer/src/types.rs
find_multi_line_duplications
called by 6
textalyzer/src/duplication.rs
calculate_line_length_histogram
called by 4
textalyzer/src/line_length.rs
as_str
called by 4
textalyzer/src/types.rs
load_files
called by 4
textalyzer/src/file_utils.rs
format_line_length_histogram
called by 3
textalyzer/src/line_length.rs
generate_frequency_map
called by 3
textalyzer/src/frequency.rs
find_all_files
called by 3
textalyzer/src/file_utils.rs

Shape

Function 36
Class 8
Method 3
Enum 2

Languages

Rust92%
Python8%

Modules by API surface

textalyzer/src/types.rs12 symbols
textalyzer/src/line_length.rs8 symbols
textalyzer/src/duplication.rs7 symbols
textalyzer/src/file_utils.rs6 symbols
examples/duplicates.py4 symbols
textalyzer/src/frequency.rs3 symbols
textalyzer/tests/integration_tests.rs2 symbols
textalyzer/src/output.rs2 symbols
textalyzer/src/main.rs2 symbols
textalyzer-wasm/src/lib.rs2 symbols
textalyzer/src/lib.rs1 symbols

For agents

$ claude mcp add Textalyzer \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page