<commit_before>
(in-package "LISA")

(use-default-engine)

(clear)

(deftemplate frodo ()
  (slot name)
  (slot has-ring)
  (slot age))

(deftemplate bilbo ()
  (slot name)
  (slot relative)
  (slot age))

(deftemplate gandalf ()
  (slot name)
  (slot age))

(deftemplate saruman ()
  (slot name))

(deftemplate samwise ()
  (slot name)
  (slot friend)
  (slot age))

(deftemplate hobbit ()
  (slot name))

(deftemplate pippin ()
  (slot name))

#+ignore
(defrule frodo ()
  (frodo (name ?name frodo))
  =>
  (format t "frodo fired: ~S~%" ?name))

#+ignore
(defrule not-frodo ()
  (frodo (name ?name (not frodo)))
  =>
  (format t "not-frodo fired: ~S~%" ?name))

#+ignore
(defrule simple-rule ()
  (frodo)
  =>
  (format t "simple-rule fired.~%"))

#+ignore
(defrule special-pattern ()
  ;;;(bilbo (name ?name) (relative ?name))
  (frodo (name ?fname) (has-ring ?ring (eq ?ring ?fname)))
  =>
  )

#+ignore
(defrule negated-slot-rule ()
  (frodo (name (not frodo)))
  =>
  )

#+ignore
(defrule shared-rule-a ()
  (frodo (name frodo))
  (gandalf (name gandalf) (age 100))
  =>
  )

#+ignore
(defrule shared-rule-b ()
  (frodo (name frodo))
  (gandalf (name gandalf) (age 200))
  =>
  )

#+ignore
(defrule constraints ()
  (frodo (name ?name))
  (samwise (name sam) (friend ?friend (not frodo)))
  =>
  (format t "constraints: ~S ~S~%" ?name ?friend))

#+ignore
(defrule variable-rule ()
  (frodo (name ?name))
  (?sam (samwise (name ?name) (friend ?name)))
  =>
  (format t "variable-rule fired: ~S~%" ?sam)
  (modify ?sam (name samwise)))

(defrule or-rule ()
  (frodo)
  (or (gandalf)
      (samwise))
  =>
  (format t "or-rule~%"))

#+ignore
(defrule or-rule ()
  (or (samwise (name sam) (friend ?name))
      (gandalf (name gandalf)))
  (frodo (name ?name))
  (or (hobbit)
      (pippin))
  (saruman)
  =>
  )

#+ignore
(defrule samwise ()
  (samwise (name samwise))
  =>
  (format t "Rule samwise fired.~%"))

#+ignore
(defrule test-rule ()
  (frodo (name ?name))
  (samwise (friend ?name) (age ?age))
  (test (eq ?age 100))
  =>
  )

#+ignore
(defrule negated-variable ()
  (frodo (name ?name))
  (samwise (friend (not ?name)))
  =>
  )<commit_msg>The OR CE is ready<commit_after>
(in-package "LISA")

(use-default-engine)

(clear)

(deftemplate frodo ()
  (slot name)
  (slot has-ring)
  (slot age))

(deftemplate bilbo ()
  (slot name)
  (slot relative)
  (slot age))

(deftemplate gandalf ()
  (slot name)
  (slot age))

(deftemplate saruman ()
  (slot name))

(deftemplate samwise ()
  (slot name)
  (slot friend)
  (slot age))

(deftemplate hobbit ()
  (slot name))

(deftemplate pippin ()
  (slot name))

#+ignore
(defrule frodo ()
  (frodo (name ?name frodo))
  =>
  (format t "frodo fired: ~S~%" ?name))

#+ignore
(defrule not-frodo ()
  (frodo (name ?name (not frodo)))
  =>
  (format t "not-frodo fired: ~S~%" ?name))

#+ignore
(defrule simple-rule ()
  (frodo)
  =>
  (format t "simple-rule fired.~%"))

#+ignore
(defrule special-pattern ()
  ;;;(bilbo (name ?name) (relative ?name))
  (frodo (name ?fname) (has-ring ?ring (eq ?ring ?fname)))
  =>
  )

#+ignore
(defrule negated-slot-rule ()
  (frodo (name (not frodo)))
  =>
  )

#+ignore
(defrule shared-rule-a ()
  (frodo (name frodo))
  (gandalf (name gandalf) (age 100))
  =>
  )

#+ignore
(defrule shared-rule-b ()
  (frodo (name frodo))
  (gandalf (name gandalf) (age 200))
  =>
  )

#+ignore
(defrule constraints ()
  (frodo (name ?name))
  (samwise (name sam) (friend ?friend (not frodo)))
  =>
  (format t "constraints: ~S ~S~%" ?name ?friend))

#+ignore
(defrule variable-rule ()
  (frodo (name ?name))
  (?sam (samwise (name ?name) (friend ?name)))
  =>
  (format t "variable-rule fired: ~S~%" ?sam)
  (modify ?sam (name samwise)))

#+ignore
(defrule or-rule ()
  (frodo)
  (or (gandalf)
      (samwise))
  =>
  (format t "or-rule~%"))

(defrule or-rule ()
  (or (samwise (name sam))
      (gandalf (name gandalf)))
  (frodo (name ?name))
  (or (hobbit)
      (pippin))
  (saruman)
  =>
  (format t "or-rule fired.~%"))

#+ignore
(defrule samwise ()
  (samwise (name samwise))
  =>
  (format t "Rule samwise fired.~%"))

#+ignore
(defrule test-rule ()
  (frodo (name ?name))
  (samwise (friend ?name) (age ?age))
  (test (eq ?age 100))
  =>
  )

#+ignore
(defrule negated-variable ()
  (frodo (name ?name))
  (samwise (friend (not ?name)))
  =>
  )
{'fraction_non_alphanumeric': 0.197134273168477, 'fraction_numerical': 0.004159926045759187, 'mean_word_length': 3.4896265560165975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 31, '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': '3165340', 'n_tokens_mistral': 1860, 'n_tokens_neox': 1813, 'n_words': 472}