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
use lang::Lang;
use script::Script;
const RELIABLE_CONFIDENCE_THRESHOLD: f64 = 0.8;
#[derive(PartialEq, Debug, Clone, Copy)]
pub struct Info {
pub(crate) lang: Lang,
pub(crate) script: Script,
pub(crate) confidence: f64
}
impl Info {
pub fn lang(&self) -> Lang {
self.lang
}
pub fn script(&self) -> Script {
self.script
}
pub fn is_reliable(&self) -> bool {
self.confidence > RELIABLE_CONFIDENCE_THRESHOLD
}
pub fn confidence(&self) -> f64 {
self.confidence
}
}