{"id":23091551,"url":"https://github.com/chopinsky/auto_correct","last_synced_at":"2025-08-16T09:30:31.088Z","repository":{"id":62438375,"uuid":"131351921","full_name":"Chopinsky/auto_correct","owner":"Chopinsky","description":"This project provides an easy-to-use service to auto correct English words","archived":false,"fork":false,"pushed_at":"2019-04-03T18:22:42.000Z","size":6291,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-13T19:08:54.974Z","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/Chopinsky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-27T22:57:07.000Z","updated_at":"2021-10-16T13:11:03.000Z","dependencies_parsed_at":"2022-11-01T21:46:26.050Z","dependency_job_id":null,"html_url":"https://github.com/Chopinsky/auto_correct","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chopinsky%2Fauto_correct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chopinsky%2Fauto_correct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chopinsky%2Fauto_correct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chopinsky%2Fauto_correct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chopinsky","download_url":"https://codeload.github.com/Chopinsky/auto_correct/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230026316,"owners_count":18161593,"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","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-12-16T21:18:37.711Z","updated_at":"2024-12-16T21:18:38.384Z","avatar_url":"https://github.com/Chopinsky.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Auto_Correct] [docsrs]\n======================\n\n[![Rusty_Express on crates.io][cratesio-image]][cratesio]\n[![Rusty_Express on docs.rs][docsrs-image]][docsrs]\n\n[cratesio]: https://crates.io/crates/auto_correct\n[cratesio-image]: https://img.shields.io/crates/v/auto_correct.svg\n[docsrs-image]: https://docs.rs/auto_correct/badge.svg\n[docsrs]: https://docs.rs/auto_correct\n\n## What is this\nThis library provides the service to suggest auto-corrections on words within 1 ~ 3 edit distances, based on configurations, where 1 edit distance denotes to one of the following operations: Insert, Remove, Replace, or Transpose. Note that the acdemic definition of the edit distance doesn't include the Transpose operation, and usually treate a Replace operation as 2 edit distances, which doesn't reflect the nature of typical typing mistakes human beings tend to make.  \n\nCurrently the project only supports English words corrections, and we plan to expand the service to more languages.\n\n## How to use\nIn your project's `Cargo.toml`, add dependency:\n```cargo\n[dependencies]\nauto_correct = \"^0.1.0\"\n...\n```\n\nIn `src\\main.rs`:\n```rust\nextern crate auto_correct;\n\nuse auto_correct::prelude::*;\n\nfn main() {\n    // Initialize the service. By default we use the EN-US dictionary with frequency pre-defined, and only give suggestions\n    // within 1 edit distance.\n    let correct_service = AutoCorrect::new();\n\n    // Vector `results` contains an array of the `Candidate` objects, which is sorted by scores\n    let results = correct_service.candidates(\"wodr\");\n\n    // Print out the result to the screen\n    for idx in 0..results.len() {\n        println!(\"Suggestion #{}: {}; Score: {}; Edit Distance: {}\",\n                    idx, results[idx].word, results[idx].score, results[idx].edit);\n    }\n}\n```\n\nAlternatively, if you would want a more responsive approach, you can use the `candidate_async` function to get the corrections:\n```rust\nextern crate auto_correct;\n\nuse std::sync::mpsc;\nuse auto_correct::prelude::*;\n\nfn main() {\n    // Initialize the service\n    let correct_service = AutoCorrect::new();\n    let (tx, rx) = mpsc::channel();\n\n    // Vector `results` contains an array of the `Candidate` objects, which is sorted by scores\n    correct_service.candidates_async(\"wodr\", tx);\n\n    // Print out the result to the screen when receiving new suggestions. Note that the received results are not ranked.\n    for result in rx {\n        println!(\"Suggestion: {}; Score: {}; Edit Distance: {}\",\n                 result.word, result.score, result.edit);\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchopinsky%2Fauto_correct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchopinsky%2Fauto_correct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchopinsky%2Fauto_correct/lists"}