{"id":16800699,"url":"https://github.com/houseme/sensitive-rs","last_synced_at":"2025-04-11T00:31:54.256Z","repository":{"id":253351335,"uuid":"843248096","full_name":"houseme/sensitive-rs","owner":"houseme","description":"Sensitive-rs is a Rust library for finding, validating, filtering, and replacing sensitive words. It provides efficient algorithms to handle sensitive words, suitable for various application scenarios.","archived":false,"fork":false,"pushed_at":"2025-04-08T02:45:57.000Z","size":444,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T03:31:13.749Z","etag":null,"topics":["dict","filter","rust","sensitive","sensitive-data","sensitive-word","sensitive-word-filter","trie","trie-tree"],"latest_commit_sha":null,"homepage":"https://houseme.github.io/sensitive-rs","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/houseme.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","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":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":"houseme","issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://paypal.me/houseme"]}},"created_at":"2024-08-16T05:12:26.000Z","updated_at":"2025-04-08T02:46:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"5f47db11-3f99-4372-8375-59ef7303f1cd","html_url":"https://github.com/houseme/sensitive-rs","commit_stats":null,"previous_names":["houseme/sensitive-rs"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fsensitive-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fsensitive-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fsensitive-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fsensitive-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/houseme","download_url":"https://codeload.github.com/houseme/sensitive-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248322272,"owners_count":21084334,"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":["dict","filter","rust","sensitive","sensitive-data","sensitive-word","sensitive-word-filter","trie","trie-tree"],"created_at":"2024-10-13T09:34:44.853Z","updated_at":"2025-04-11T00:31:54.160Z","avatar_url":"https://github.com/houseme.png","language":"Rust","funding_links":["https://liberapay.com/houseme","https://paypal.me/houseme"],"categories":[],"sub_categories":[],"readme":"# Sensitive-rs\n\nEnglish [中文](README_CN.md)\n\n[![Build](https://github.com/houseme/sensitive-rs/workflows/Build/badge.svg)](https://github.com/houseme/sensitive-rs/actions?query=workflow%3ABuild)\n[![crates.io](https://img.shields.io/crates/v/sensitive-rs.svg)](https://crates.io/crates/sensitive-rs)\n[![docs.rs](https://docs.rs/sensitive-rs/badge.svg)](https://docs.rs/sensitive-rs/)\n[![License](https://img.shields.io/crates/l/sensitive-rs)](./LICENSE-APACHE)\n[![Crates.io](https://img.shields.io/crates/d/sensitive-rs)](https://crates.io/crates/sensitive-rs)\n\nSensitive-rs is a Rust library for finding, validating, filtering, and replacing sensitive words. It provides efficient\nalgorithms to handle sensitive words, suitable for various application scenarios.\n\n## Features\n\n- **Find**: Locate all sensitive words in a text.\n- **Validate**: Check if a text contains any sensitive words.\n- **Filter**: Remove sensitive words from a text.\n- **Replace**: Replace sensitive words in a text with specified characters.\n\n## Installation\n\nAdd the following dependency to your `Cargo.toml`:\n\n```toml\n[dependencies]\nsensitive-rs = \"0.1\"\n```\n\n## Usage Examples\n\nHere are some examples of how to use Sensitive-rs:\n\nHere is an example of how to use the Filter struct\n\n```rust\nuse sensitive_rs::Filter;\n\nfn main() {\n    // Create a new Filter\n    let mut filter = Filter::new();\n    filter.add_word(\"bad\");\n    filter.add_word(\"worse\");\n\n    // Find sensitive words\n    let result = filter.find_in(\"This is bad.\");\n    assert_eq!(result, (true, \"bad\".to_string()));\n\n    // Validate text\n    let result = filter.validate(\"This is worse.\");\n    assert_eq!(result, (true, \"worse\".to_string()));\n\n    // Filter sensitive words\n    let filtered_text = filter.filter(\"This is bad and worse.\");\n    assert_eq!(filtered_text, \"This is  and .\");\n\n    // Replace sensitive words\n    let replaced_text = filter.replace(\"This is bad and worse.\", '*');\n    assert_eq!(replaced_text, \"This is *** and *****.\");\n}\n```\n\nHere is an example of how to use the Trie struct\n\n```rust\nuse sensitive_rs::Trie;\n\nfn main() {\n    // Create a new Trie filter\n    let filter = Trie::new();\n    filter.add_word(\"bad\");\n    filter.add_word(\"worse\");\n\n    // Find sensitive words\n    let result = filter.find_in(\"This is bad.\");\n    assert_eq!(result, Some(\"bad\".to_string()));\n\n    // Validate text\n    let result = filter.validate(\"This is worse.\");\n    assert_eq!(result, Some(\"worse\".to_string()));\n\n    // Filter sensitive words\n    let filtered_text = filter.filter(\"This is bad and worse.\");\n    assert_eq!(filtered_text, \"This is  and .\");\n\n    // Replace sensitive words\n    let replaced_text = filter.replace(\"This is bad and worse.\", '*');\n    assert_eq!(replaced_text, \"This is *** and *****.\");\n}\n```\n\n## Documentation\n\nFor detailed documentation, please refer to [Documentation](https://docs.rs/sensitive-rs).\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0, [LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0\n* MIT license [LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as\ndefined in the Apache-2.0 or MIT license, shall be dual licensed as above, without any additional terms or conditions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhouseme%2Fsensitive-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhouseme%2Fsensitive-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhouseme%2Fsensitive-rs/lists"}