diff --git a/.gitignore b/.gitignore index 3ca43ae..193d30e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,8 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb + + +# Added by cargo + +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..48e6313 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "john_slop" +version = "0.1.0" +edition = "2024" + +[dependencies] +miette = { version = "7.6.0", features = ["fancy"] } +thiserror = "2.0.17" diff --git a/README.md b/README.md index 1420fca..02740d7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ # JohnSlop -Detect AI slop markers \ No newline at end of file +Detect AI slop markers + + +# Links +* [https://en.wikipedia.org/wiki/Wikipedia%3ASigns_of_AI_writing] +* [https://en.wikipedia.org/wiki/Wikipedia:WikiProject_AI_Cleanup] +* [https://www.theverge.com/report/756810/wikipedia-ai-slop-policies-community-speedy-deletion] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..6035e11 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,63 @@ +// ────────────────────────────────────────────────────────────────────── +// Cargo.toml +// ────────────────────────────────────────────────────────────────────── +// [dependencies] +// miette = "7" +// ────────────────────────────────────────────────────────────────────── + +use miette::{LabeledSpan, miette}; + +/// Creates a diagnostic for the ambiguous Unicode character U+2011 +/// (non‑breaking hyphen) that can be confused with the ordinary hyphen U+002D. +fn unicode_confusion_report() -> miette::Report { + // The source text you want to annotate + let source = "Validate that the configuration file at path is well‑formed.".to_string(); + + // Build the report + miette!( + // Label the exact character that is problematic (index 52 in the string) + labels = vec![LabeledSpan::at(52..53, "non‑breaking hyphen U+2011")], + // Help text that tells the user what to do + help = "This file contains ambiguous Unicode characters that might be \n\ + confused with other characters. This is often the mark of AI\n\ + generated text.", + // Short description shown in the diagnostic title + "Ambiguous Unicode character detected" + ) + // Attach the source code to the report so that miette can pretty‑print it + .with_source_code(source) +} + +/// Creates a diagnostic for text that looks like it was generated by an AI, +/// because it contains the phrase “as of my last knowledge update”. +fn ai_generated_report() -> miette::Report { + // The source text you want to annotate + let source = "As of my last knowledge update in January 2022, a historic \n + peace agreement between the Colombian government and the \ + Revolutionary Armed Forces of Colombia" + .to_string(); + + // Build the report + miette!( + // Label the suspicious phrase (roughly the first 34 characters) + labels = vec![LabeledSpan::at(0..34, "\"as of my last knowledge update\"")], + help = "If the text contains phrases like \"as an AI model\" or \"as of my \n\ + last knowledge update\", or if the editor copy‑pasted the \n\ + prompt used to generate the text together with the AI \n\ + response, the text is almost certainly AI‑generated.", + "Potential AI‑generated content detected" + ) + .with_source_code(source) +} + +fn main() -> Result<(), Box> { + // Show the Unicode‑confusion diagnostic + let report1 = unicode_confusion_report(); + println!("{:?}\n", report1); + + // Show the AI‑generated‑text diagnostic + let report2 = ai_generated_report(); + println!("{:?}", report2); + + Ok(()) +}