1extern crate core;
2
3use std::collections::HashSet;
4use std::hash::Hash;
5
6pub use deunicode;
7pub use rayon;
8pub use smallvec;
9pub use ustr;
10
11pub mod coordinates;
12mod graph;
13pub mod location;
14pub mod locations_db;
15pub mod search;
16
17const SCORE_SOFT_MAX: i64 = 1000;
18const STATE_CODE_BOOST: i64 = 32;
19const SUBDIV_CODE_BOOST: i64 = 16;
20const LEV_3_LENGTH_MAX: usize = 10;
21const LEV_2_LENGTH_MAX: usize = 20;
22const LEV_LENGTH_MAX: usize = 40;
23
24const SINGLE_WORD_MATCH_PENALTY: i64 = 100;
25
26const SEARCH_INCLUSION_THRESHOLD: i64 = 400;
27const GRAPH_EDGE_THRESHOLD: i64 = 600;
28
29pub fn normalize(s: &str) -> String {
30 deunicode::deunicode(s).to_lowercase()
31}
32
33pub fn dedup<T: Eq + Hash>(vec: Vec<T>) -> Vec<T> {
34 vec.into_iter()
35 .collect::<HashSet<T>>()
36 .into_iter()
37 .collect()
38}