1const FIRST_NAME_DATA: &str = concat!(
2 include_str!("../data/names/fungi.txt"),
3 include_str!("../data/names/herbs.txt"),
4 include_str!("../data/names/knots.txt"),
5 include_str!("../data/names/nature.txt"),
6 include_str!("../data/names/stars.txt"),
7 include_str!("../data/names/winds.txt"),
8);
9
10const FAMILY_NAME_DATA: &str = concat!(
11 include_str!("../data/names/shipping.txt"),
12 include_str!("../data/names/trades.txt"),
13);
14
15const REALM_DATA: &str = include_str!("../data/realms.txt");
16
17pub fn first_names() -> Vec<&'static str> {
18 unique_words(FIRST_NAME_DATA)
19}
20
21pub fn family_names() -> Vec<&'static str> {
22 unique_words(FAMILY_NAME_DATA)
23}
24
25pub fn candidate_realms() -> Vec<&'static str> {
26 unique_words(REALM_DATA)
27}
28
29fn unique_words(data: &'static str) -> Vec<&'static str> {
30 let mut words = Vec::new();
31 for word in data.lines().map(str::trim).filter(|word| !word.is_empty()) {
32 if !words.contains(&word) {
33 words.push(word);
34 }
35 }
36 words
37}