https://github.com/benoitprmt/levenshtein-distance
Levenshtein distance algorithm implementation in Rust
https://github.com/benoitprmt/levenshtein-distance
levenshtein-distance rust rust-learning
Last synced: 7 months ago
JSON representation
Levenshtein distance algorithm implementation in Rust
- Host: GitHub
- URL: https://github.com/benoitprmt/levenshtein-distance
- Owner: BenoitPrmt
- Created: 2025-04-09T17:11:37.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-04-09T17:55:08.000Z (10 months ago)
- Last Synced: 2025-04-10T12:06:02.776Z (10 months ago)
- Topics: levenshtein-distance, rust, rust-learning
- Language: Rust
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐งฎ Levenshtein Distance in Rust
A simple Rust implementation of the [Levenshtein distance algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance), used to calculate the minimum number of single-character edits required to change one string into another.
This project is a learning exercise to explore Rust basics, algorithms, and project organization.
## ๐ Project Structure
```
src/
โโโ main.rs
โโโ levenshtein.rs
โโโ spellchecker.rs
```
## ๐ Getting Started
Make sure you have [Rust installed](https://rustup.rs/).
```bash
# Clone the project
git clone https://github.com/BenoitPrmt/levenshtein-distance.git
cd levenshtein-distance
# Run the main program
cargo run
# Run tests
cargo test
```
## ๐ฆ Features
- Calculates Levenshtein distance between two strings
- Spell checker using Levenshtein distance
-> Suggests the closest word from a dictionary for a given input
- Includes unit and integration tests
- Modular project structure
## ๐ง Example Output
```
Distance de Levenshtein entre "chat" et "chats" : 1
Mot recherchรฉ: chzt
Suggestions:
- chat
```
## ๐ง Notes
- For simplicity, this implementation assumes ASCII strings. Unicode support would require working with `.chars()` instead of `.as_bytes()`.
## โ
TODO
- [ ] Import dictionary from a file (spellchecker)
- [ ] Build CLI to check spelling
- [ ] Build little API to use tools easily through other projects
## ๐ License
MIT License. Free to use and modify.