{"id":18829359,"url":"https://github.com/inspirateur/wordcloud-rs","last_synced_at":"2025-04-14T03:33:36.778Z","repository":{"id":64224604,"uuid":"574179119","full_name":"Inspirateur/wordcloud-rs","owner":"Inspirateur","description":"Rust library to generate word cloud images from text and images !","archived":false,"fork":false,"pushed_at":"2025-01-22T10:24:51.000Z","size":3758,"stargazers_count":14,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T17:37:32.613Z","etag":null,"topics":["rust","rust-crate","rust-library","wordcloud","wordcloud-generator","wordcloud-visualization"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/wordcloud-rs","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Inspirateur.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-04T17:09:18.000Z","updated_at":"2025-03-26T13:52:34.000Z","dependencies_parsed_at":"2024-10-30T10:36:51.398Z","dependency_job_id":null,"html_url":"https://github.com/Inspirateur/wordcloud-rs","commit_stats":{"total_commits":24,"total_committers":1,"mean_commits":24.0,"dds":0.0,"last_synced_commit":"491833691119b8588b1a4844da5e0d233b5b3ff2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inspirateur%2Fwordcloud-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inspirateur%2Fwordcloud-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inspirateur%2Fwordcloud-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inspirateur%2Fwordcloud-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Inspirateur","download_url":"https://codeload.github.com/Inspirateur/wordcloud-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248815947,"owners_count":21165988,"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":["rust","rust-crate","rust-library","wordcloud","wordcloud-generator","wordcloud-visualization"],"created_at":"2024-11-08T01:44:29.214Z","updated_at":"2025-04-14T03:33:31.768Z","avatar_url":"https://github.com/Inspirateur.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wordcloud-rs\nA Rust library to generate word-clouds from text and images!\n\n## Example \n### Code\n```rust\nuse std::collections::HashMap;\nuse std::fs;\nuse lazy_static::lazy_static;\nuse regex::Regex;\nuse wordcloud_rs::*;\n\nlazy_static! {\n    static ref RE_TOKEN: Regex = Regex::new(r\"\\w+\").unwrap();\n}\n\nfn tokenize(text: String) -\u003e Vec\u003c(Token, f32)\u003e {\n    let mut counts: HashMap\u003cString, usize\u003e = HashMap::new();\n    for token in RE_TOKEN.find_iter(\u0026text) {\n        *counts.entry(token.as_str().to_string()).or_default() += 1;\n    }\n    counts.into_iter().map(|(k, v)| (Token::Text(k), v as f32)).collect()\n}\n\nfn main() {\n    // Prepare the tokens\n    let text = fs::read_to_string(\"assets/sample_text.txt\").unwrap();\n    let mut tokens = tokenize(text);\n    tokens.push((Token::from(\"assets/alan_turing.jpg\"), 15.));\n    tokens.push((Token::from(\"assets/turing_statue_bletchley.jpg\"), 20.));\n    tokens.push((Token::Text(\"💻\".to_string()), 20.));\n    // Generate the word-cloud\n    let wc = WordCloud::new().generate(tokens);\n    // Save it\n    wc.save(\"sample_cloud.png\").unwrap();\n}\n```\n### Output\n![word_cloud_demo](https://github.com/Inspirateur/wordcloud-rs/raw/main/sample_cloud.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finspirateur%2Fwordcloud-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finspirateur%2Fwordcloud-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finspirateur%2Fwordcloud-rs/lists"}