Created
July 23, 2022 18:01
-
-
Save bee-san/dc91da3e78d32ba42f88148ec3d6857e to your computer and use it in GitHub Desktop.
line 36 is the problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use log::{debug, info, trace}; | |
use crate::checkers::checker_type::{CheckerType, Check}; | |
impl EnglishChecker { | |
pub fn new() -> Self { | |
Self { | |
checker_type: CheckerType { | |
name: "English Checker", | |
description: "This checker checks if the text is english looping over a dictionary", | |
link: "https://en.wikipedia.org/wiki/English_language", | |
tags: vec!["english", "dictionary"], | |
/// Expected runtime is higher as this is a O(n) checker | |
expected_runtime: 0.01, | |
/// Popularity is max because English is the most popular | |
/// Plaintext language in the world. | |
popularity: 1.0, | |
..Default::default() | |
} | |
} | |
} | |
} | |
/// given an input, check every item in the array and return true if any of them match | |
impl Check for EnglishChecker { | |
fn check(&self, input: &str) -> CheckResult { | |
if let Some(result) = storage::DICTIONARIES | |
.iter() | |
.find(|(_, words)| words.contains(input)) | |
{ | |
// result.0 is filename | |
return CheckResult { | |
is_identified: true, | |
text: input, | |
checker: EnglishChecker::new(), | |
}; | |
} | |
None | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment