1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*!
WordCloud: A simplified way to create Wordclouds in Rust.
### Simple Example
```
use wordcloud::*;
use wordcloud::font::*;
let mut font_data = Vec::from(include_bytes!("font.ttf") as &[u8]);
let font_set = FontSetBuilder::new()
.push(Font::from_data(&mut font_data).unwrap())
.build();
let output_dimensions = Dimensions::from_wh(1000, 1000);
let wc = WordCloudBuilder::new()
.dimensions(output_dimensions)
.font(&font_set)
.build()
.unwrap();
let input_text = io::read_string_from_file("input_text.txt").unwrap();
let ranked = RankedWords::rank(input_text.split_whitespace().collect());
wc.write_content(ranked, 2000);
wc.export_rendered_to_file("output.svg").unwrap();
```
## Using Stopwords
```
use wordcloud::*;
use wordcloud::font::*;
// Create the default StopWords set using the "stopwords" crate feature
let stop_words = StopWords::default();
let input_text = io::read_string_from_file("input_text.txt").unwrap();
let ranked = RankedWords::rank(
input_text
.split_whitespace()
// filter out the StopWords using the iterator function
// a similar named function also exists for rayon's ParallelIterators
.filter_stop_words(&stop_words)
// filter out everything that is just a number
.filter(
|x| x.parse::<f64>().is_err()
)
.collect()
);
// ...
```
## Using Background Images
```
use wordcloud::*;
// ...
let image = image::load_from_memory(test_image).expect("image load failed");
let wc = WordCloudBuilder::new()
.dimensions(output_dimensions)
.font(&font_set)
.image(&image)
.build()
.unwrap();
// ...
```
Example results can be found on the GitHub page.
*/
/**
Provides helpers for IO-Operations
*/
pub use *;
pub use *;
pub use font;
pub use crateDimensions;
pub use RankedWords;