Skip to content

Commit

Permalink
Update to askalono 0.4.0 and use a more strict confidence threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
ebroto committed Nov 9, 2019
1 parent f74f741 commit 6ae318c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exclude = ["assets/*.png"]
colored= "1.8.0"
git2 = {version = "0.7.5", default-features = false}
tokei = "10.0"
askalono = { git = "https://github.com/amzn/askalono.git", rev = "39f6e228775e17266bcba46f48b26b01bbfb7698" }
askalono = "0.4.0"
bytecount = "0.5.1"
clap = "2.33.0"
strum = "0.16.0"
Expand Down
3 changes: 2 additions & 1 deletion src/license.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::Error;
type Result<T> = std::result::Result<T, Error>;

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

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

if matched.score > 0. {
if matched.score >= MIN_THRESHOLD {
Some(matched.name.into())
} else {
None
Expand Down

0 comments on commit 6ae318c

Please sign in to comment.