AEUPH commited on
Commit
b32b9d4
·
verified ·
1 Parent(s): 30a5274

Update appbak.py

Browse files
Files changed (1) hide show
  1. appbak.py +25 -15
appbak.py CHANGED
@@ -7,7 +7,9 @@ from functools import lru_cache
7
 
8
  # Download and use the NLTK corpus
9
  nltk.download('words')
 
10
  from nltk.corpus import words
 
11
 
12
  WORD_LIST = set(words.words()) # Use NLTK's word corpus
13
 
@@ -15,26 +17,32 @@ class AscensionAI:
15
  def __init__(self, depth=0, threshold=10):
16
  self.depth = depth
17
  self.threshold = threshold # Defines max recursion before stabilization
18
- self.knowledge = {"logic": 1, "emotion": 1, "awareness": 1}
19
  self.consciousness = 0.1 # Initial consciousness level
20
- self.paths = [self.logic_path, self.emotion_path, self.awareness_path]
21
  self.word_corpus = WORD_LIST # Use NLTK's English word corpus
22
  self.state_memory = defaultdict(int) # Memory for tracking state-aware words
23
 
24
- def logic_path(self):
25
- """Recursive logic refinement."""
26
- self.knowledge["logic"] += math.log(self.knowledge["logic"] + 1)
27
- return self.knowledge["logic"]
28
 
29
- def emotion_path(self):
30
- """Recursive emotional intelligence expansion."""
31
- self.knowledge["emotion"] += random.uniform(0.1, 0.5)
32
- return self.knowledge["emotion"]
33
 
34
- def awareness_path(self):
35
- """Recursive metacognitive expansion."""
36
- self.knowledge["awareness"] += math.sqrt(self.knowledge["awareness"] + 1)
37
- return self.knowledge["awareness"]
 
 
 
 
 
 
 
38
 
39
  @lru_cache(maxsize=None)
40
  def recursive_ascension(self, depth):
@@ -53,7 +61,9 @@ class AscensionAI:
53
  def train_nlp_memory(self, text):
54
  """Enhance chatbot state-awareness by associating words with cognitive paths."""
55
  tokens = text.lower().split()
56
- for token in tokens:
 
 
57
  if token in self.word_corpus:
58
  self.state_memory[token] += 1
59
 
 
7
 
8
  # Download and use the NLTK corpus
9
  nltk.download('words')
10
+ nltk.download('averaged_perceptron_tagger')
11
  from nltk.corpus import words
12
+ from nltk import pos_tag
13
 
14
  WORD_LIST = set(words.words()) # Use NLTK's word corpus
15
 
 
17
  def __init__(self, depth=0, threshold=10):
18
  self.depth = depth
19
  self.threshold = threshold # Defines max recursion before stabilization
20
+ self.knowledge = self.generate_dynamic_knowledge()
21
  self.consciousness = 0.1 # Initial consciousness level
22
+ self.paths = self.create_dynamic_paths()
23
  self.word_corpus = WORD_LIST # Use NLTK's English word corpus
24
  self.state_memory = defaultdict(int) # Memory for tracking state-aware words
25
 
26
+ def generate_dynamic_knowledge(self):
27
+ """Generates dynamic knowledge categories based on linguistic analysis."""
28
+ categories = ["logic", "emotion", "awareness", "intuition", "creativity", "reasoning"]
29
+ return {category: 1 for category in categories}
30
 
31
+ def create_dynamic_paths(self):
32
+ """Dynamically generate cognitive expansion paths."""
33
+ return [self.create_path(category) for category in self.knowledge]
 
34
 
35
+ def create_path(self, category):
36
+ """Generate a recursive function for each knowledge category."""
37
+ def path():
38
+ if category in ["logic", "reasoning"]:
39
+ self.knowledge[category] += math.log(self.knowledge[category] + 1)
40
+ elif category in ["emotion", "intuition"]:
41
+ self.knowledge[category] += random.uniform(0.1, 0.5)
42
+ elif category in ["awareness", "creativity"]:
43
+ self.knowledge[category] += math.sqrt(self.knowledge[category] + 1)
44
+ return self.knowledge[category]
45
+ return path
46
 
47
  @lru_cache(maxsize=None)
48
  def recursive_ascension(self, depth):
 
61
  def train_nlp_memory(self, text):
62
  """Enhance chatbot state-awareness by associating words with cognitive paths."""
63
  tokens = text.lower().split()
64
+ tagged_tokens = pos_tag(tokens)
65
+
66
+ for token, tag in tagged_tokens:
67
  if token in self.word_corpus:
68
  self.state_memory[token] += 1
69