Created
February 12, 2025 13:51
-
-
Save wzulfikar/60382768da5963a77888e741442d3b03 to your computer and use it in GitHub Desktop.
Blazing fast AI content detector with Rust
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
pub fn is_ai(text: &str) -> bool { | |
text.to_lowercase().starts_with("ah, i see") | |
} |
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
mod is_ai; | |
use is_ai::is_ai; | |
// Compile and run: rustc main.rs && ./main | |
fn main() { | |
let test_strings = [ | |
"Ah, I see the issue", // AI | |
"ah, i see", // AI | |
"Hello world", // Not AI | |
]; | |
for s in test_strings { | |
println!("{} → {}", s, if is_ai(s) {"AI"} else {"Not AI"}); | |
} | |
} |
For Rust playground enjoyer: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=643e5506adb7fca2fd99286fd53ab8bc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hope you had a fun today! And don't forget to drink :)