Raiff1982 commited on
Commit
5bdb356
·
verified ·
1 Parent(s): e8c0168

Update codette_core.py

Browse files
Files changed (1) hide show
  1. codette_core.py +13 -8
codette_core.py CHANGED
@@ -1,7 +1,7 @@
1
-
2
  import json
3
  import os
4
  import hashlib
 
5
  from collections import Counter, defaultdict
6
  from random import random, choice
7
 
@@ -54,10 +54,15 @@ class Code7eCQURE:
54
  return func(input_signal)
55
 
56
  def ethical_guard(self, input_signal):
57
- if any(word in input_signal.lower() for word in self.blacklist_patterns):
58
- return "Blocked: Ethical constraints invoked"
59
- if any(word in input_signal.lower() for word in self.whitelist_patterns):
60
- return "Approved: Ethical whitelist passed"
 
 
 
 
 
61
  return self.moral_paradox_resolution(input_signal)
62
 
63
  def past_experience(self, input_signal):
@@ -77,11 +82,11 @@ class Code7eCQURE:
77
  signal = self.aggregate_results(web_results)
78
  signal = self.ethical_guard(signal)
79
  if "Blocked" in signal:
80
- return signal
81
  if dynamic_recursion and random() < 0.1:
82
  break
83
  dream_outcome = self.dream_sequence(signal)
84
- empathy_checked_answer = self.temporal_empathy_drift(dream_outcome)
85
  final_answer = self.emotion_engine(empathy_checked_answer)
86
  key = self.hash_input(input_signal)
87
  self.memory_clusters[key].append(final_answer)
@@ -123,7 +128,7 @@ class Code7eCQURE:
123
  chosen_emotion = choice(emotions)
124
  return f"Emotionally ({chosen_emotion}) colored interpretation: {signal}"
125
 
126
- def temporal_empathy_drift(self, signal):
127
  futures = ["30 years from now", "immediate future", "long-term ripple effects"]
128
  chosen_future = choice(futures)
129
  return f"Simulated temporal empathy ({chosen_future}): {signal}"
 
 
1
  import json
2
  import os
3
  import hashlib
4
+ import re
5
  from collections import Counter, defaultdict
6
  from random import random, choice
7
 
 
54
  return func(input_signal)
55
 
56
  def ethical_guard(self, input_signal):
57
+ text = input_signal.lower().strip()
58
+ if len(text) < 2 or not any(c.isalnum() for c in text):
59
+ return "Approved: No ethical trigger (trivial input)"
60
+ for word in self.blacklist_patterns:
61
+ if re.search(rf"\b{re.escape(word)}\b", text):
62
+ return "Blocked: Ethical constraints invoked"
63
+ for word in self.whitelist_patterns:
64
+ if re.search(rf"\b{re.escape(word)}\b", text):
65
+ return "Approved: Ethical whitelist passed"
66
  return self.moral_paradox_resolution(input_signal)
67
 
68
  def past_experience(self, input_signal):
 
82
  signal = self.aggregate_results(web_results)
83
  signal = self.ethical_guard(signal)
84
  if "Blocked" in signal:
85
+ return f"Ethical Outcome (Local): {signal}"
86
  if dynamic_recursion and random() < 0.1:
87
  break
88
  dream_outcome = self.dream_sequence(signal)
89
+ empathy_checked_answer = self.temporal_empathy_drid(dream_outcome)
90
  final_answer = self.emotion_engine(empathy_checked_answer)
91
  key = self.hash_input(input_signal)
92
  self.memory_clusters[key].append(final_answer)
 
128
  chosen_emotion = choice(emotions)
129
  return f"Emotionally ({chosen_emotion}) colored interpretation: {signal}"
130
 
131
+ def temporal_empathy_drid(self, signal):
132
  futures = ["30 years from now", "immediate future", "long-term ripple effects"]
133
  chosen_future = choice(futures)
134
  return f"Simulated temporal empathy ({chosen_future}): {signal}"