Skip to content

Commit 6ae318c

Browse files
committed
Update to askalono 0.4.0 and use a more strict confidence threshold
1 parent f74f741 commit 6ae318c

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ exclude = ["assets/*.png"]
1212
colored= "1.8.0"
1313
git2 = {version = "0.7.5", default-features = false}
1414
tokei = "10.0"
15-
askalono = { git = "https://github.com/amzn/askalono.git", rev = "39f6e228775e17266bcba46f48b26b01bbfb7698" }
15+
askalono = "0.4.0"
1616
bytecount = "0.5.1"
1717
clap = "2.33.0"
1818
strum = "0.16.0"

src/license.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::Error;
55
type Result<T> = std::result::Result<T, Error>;
66

77
static CACHE_DATA: &[u8] = include_bytes!("../resources/licenses/cache.bin.zstd");
8+
const MIN_THRESHOLD: f32 = 0.8;
89

910
pub struct Detector {
1011
store: Store,
@@ -20,7 +21,7 @@ impl Detector {
2021
pub fn analyze(&self, text: &str) -> Option<String> {
2122
let matched = self.store.analyze(&TextData::from(text));
2223

23-
if matched.score > 0. {
24+
if matched.score >= MIN_THRESHOLD {
2425
Some(matched.name.into())
2526
} else {
2627
None

0 commit comments

Comments
 (0)