Content-based programming language detector CLI.
langdetect identifies a file's language by analyzing syntax patterns in the file content, not by filename extension.
- Detects 50+ programming languages
- Uses weighted syntax fingerprints
- Reports best match plus alternate likely matches
- Works even when file extensions are wrong or missing
pip install -e .langdetect path/to/file
langdetect path/to/file --verboseExample output:
Best match : Scala (88.6%)
Also possible : Nim (23% rel.) | Kotlin (22% rel.)
- The detector scores each language against regex-based fingerprints.
- The highest score is reported as the best match.
- Confidence is based on score separation between the top and runner-up languages.
- Add fixture-driven accuracy tests
- Add optional JSON output mode
- Add plugin support for custom language fingerprints
Please read CONTRIBUTING.md before opening a pull request.
To report vulnerabilities, see SECURITY.md.
MIT License. See LICENSE.