<commit_before>open Core

let create_spooky_words_regex words =
  let regexp = String.drop_suffix (List.fold_right words ~f:(fun acc curr -> acc ^ "|" ^ curr) ~init:"") 1 in
    Re2.Regex.create_exn regexp

let spooky_words = create_spooky_words_regex [
  "spooky";
  "scary";
  "scream";
  "ghost";
  "skeleton";
  "wolf";
  "jack-o-lantern";
  "bat";
  "dracula";
  "vampire";
  "witch";
  "blood";
  "dead";
  "devil";
  "666";
  "boo";
  "creepy";
  "creppy";
  "spoopy";
  "satan";
  "murder";
  "death";
  "dead";
  "A+(!+)?";
  "A+H+(!+)?";
]

let not_scary_words = create_spooky_words_regex (* these words arent spooky but code reuse lol *) [
  "not";
  "isnt";
]

let its_scary str =
  (Re2.Regex.matches spooky_words str) && (not (Re2.Regex.matches not_scary_words str))<commit_msg>The regex artificial intelligence grows more powerful<commit_after>open Core

let create_spooky_words_regex words =
  let regexp = String.drop_suffix (List.fold_right words ~f:(fun acc curr -> acc ^ "|" ^ curr) ~init:"") 1 in
    Re2.Regex.create_exn regexp

let spooky_words = create_spooky_words_regex [
  "spooky";
  "scary";
  "scream";
  "ghost";
  "skeleton";
  "wolf";
  "jack-o-lantern";
  "bat";
  "dracula";
  "vampire";
  "witch";
  "blood";
  "dead";
  "devil";
  "666";
  "boo";
  "creepy";
  "creppy";
  "spoopy";
  "satan";
  "murder";
  "death";
  "dead";
  "A+(!+)?";
  "A+H+(!+)?";
]

let not_scary_words = create_spooky_words_regex (* these words arent spooky but code reuse lol *) [
  "not";
  "isn(')?t";
]

let its_scary str =
  (Re2.Regex.matches spooky_words str) && (not (Re2.Regex.matches not_scary_words str))
{'fraction_non_alphanumeric': 0.18058968058968058, 'fraction_numerical': 0.0085995085995086, 'mean_word_length': 3.891891891891892, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1941641', 'n_tokens_mistral': 728, 'n_tokens_neox': 705, 'n_words': 147}