{"id":18976297,"url":"https://github.com/quickwit-oss/levenshtein-automata","last_synced_at":"2025-12-12T15:35:29.967Z","repository":{"id":37725956,"uuid":"110902512","full_name":"quickwit-oss/levenshtein-automata","owner":"quickwit-oss","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-28T04:00:01.000Z","size":48,"stargazers_count":67,"open_issues_count":3,"forks_count":14,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-10-01T14:56:27.801Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quickwit-oss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"fulmicoton","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-11-16T00:26:08.000Z","updated_at":"2025-09-27T04:47:55.000Z","dependencies_parsed_at":"2024-06-19T01:54:31.145Z","dependency_job_id":null,"html_url":"https://github.com/quickwit-oss/levenshtein-automata","commit_stats":null,"previous_names":["tantivy-search/levenshtein-automata"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/quickwit-oss/levenshtein-automata","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickwit-oss%2Flevenshtein-automata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickwit-oss%2Flevenshtein-automata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickwit-oss%2Flevenshtein-automata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickwit-oss%2Flevenshtein-automata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quickwit-oss","download_url":"https://codeload.github.com/quickwit-oss/levenshtein-automata/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickwit-oss%2Flevenshtein-automata/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27685559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T15:23:30.880Z","updated_at":"2025-12-12T15:35:29.944Z","avatar_url":"https://github.com/quickwit-oss.png","language":"Rust","funding_links":["https://github.com/sponsors/fulmicoton"],"categories":[],"sub_categories":[],"readme":"# Levenshtein-automaton\n\nThis crate makes it fast and simple to build a finite determinic automaton that computes\nthe levenshtein distance from a given string.\n\n# Example\n\n```rust\nuse levenshtein_automata::{LevenshteinAutomatonBuilder, Distance};\n\nfn main() {\n\n    // Building this factory is not free.\n    let lev_automaton_builder = LevenshteinAutomatonBuilder::new(2, true);\n\n    // We can now build an entire dfa.\n    let dfa = lev_automaton_builder.build_dfa(\"Levenshtein\");\n\n    let mut state = dfa.initial_state();\n    for \u0026b in \"Levenshtain\".as_bytes() {\n        state = dfa.transition(state, b);\n    }\n\n    assert_eq!(dfa.distance(state), Distance::Exact(1));\n}\n```\n\nThe implementation is based on the following paper\n**Fast String Correction with Levenshtein-Automata (2002)** by by Klaus Schulz and Stoyan Mihov.\nI also tried to explain it in the following [blog post](https://fulmicoton.com/posts/levenshtein/).\n\n\n# Bench\n\n\nThe time taken by the construction a Levenshtein DFA\nstrongly depends on the max distance it can measure and the length of the input string.\n\nHere is the time spent to build a Levenshtein DFA for the string \"Levenshtein\"\n\n\n```ignore\ndfa dist1 no transposition        35,627 ns/iter (+/- 3,237)\ndfa dist1 with transposition      36,493 ns/iter (+/- 12,680)\ndfa dist2 no transposition        97,137 ns/iter (+/- 14,556)\ndfa dist2 with transposition     100,958 ns/iter (+/- 4,231)\ndfa dist3 no transposition       834,412 ns/iter (+/- 158,329)\ndfa dist3 with transposition   1,414,523 ns/iter (+/- 396,278)\ndfa dist4 no transposition     4,716,365 ns/iter (+/- 869,024)\ndfa dist4 with transposition   8,044,162 ns/iter (+/- 594,523)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquickwit-oss%2Flevenshtein-automata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquickwit-oss%2Flevenshtein-automata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquickwit-oss%2Flevenshtein-automata/lists"}