-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.rs
68 lines (65 loc) · 1.62 KB
/
test.rs
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
use crate::types::*;
pub const ALPHABET: &[&[&str]] = &[
&["a", "A"],
&["b", "B"],
&["c", "C"],
&["d", "D"],
&["e", "E"],
&["f", "F"],
&["g", "G"],
&["h", "H"],
&["i", "I"],
&["j", "J"],
&["k", "K"],
&["l", "L"],
&["m", "M"],
&["n", "N"],
&["o", "O"],
&["p", "P"],
&["q", "Q"],
&["r", "R"],
&["s", "S"],
&["t", "T"],
&["u", "U"],
&["v", "V"],
&["w", "W"],
&["x", "X"],
&["y", "Y"],
&["z", "Z"],
&[".", ","],
];
pub fn get_test_alphabet() -> (Alphabet, CharIndexType) {
//this is a bit silly to do so verbosely here just to get
//everything in Vecss and Strings, but it works
let mut alphabet: Alphabet = Vec::new();
for chars in ALPHABET {
let mut ownedchars: Vec<String> = Vec::new();
for c in *chars {
ownedchars.push(c.to_string());
}
alphabet.push(ownedchars);
}
let l = alphabet.len();
(alphabet, l as CharIndexType)
}
pub fn get_test_searchparams() -> SearchParameters {
SearchParameters {
max_edit_distance: DistanceThreshold::Absolute(2),
max_anagram_distance: DistanceThreshold::Absolute(2),
max_matches: 10,
stop_criterion: StopCriterion::Exhaustive,
score_threshold: 0.0,
cutoff_threshold: 0.0,
max_ngram: 2,
lm_order: 2,
freq_weight: 0.0,
single_thread: true,
context_weight: 0.0,
lm_weight: 1.0,
variantmodel_weight: 3.0,
contextrules_weight: 1.0,
max_seq: 250,
consolidate_matches: true,
unicodeoffsets: false,
}
}