dynamic-learning-model 3.3.6.1__tar.gz → 3.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dynamic-learning-model
3
- Version: 3.3.6.1
3
+ Version: 3.4.1
4
4
  Summary: A Dynamic Learning Model for processing NLP queries using hybrid AI and reasoning.
5
5
  Home-page: https://github.com/VigneshT24/Dynamic_Learning_Model
6
6
  Author: Vignesh Thondikulam
@@ -417,7 +417,7 @@ class DLM:
417
417
  confirmation = input("You cannot proceed to train without understanding the instructions aforementioned. Type 'Y' to continue: ")
418
418
  self.__mode = "learn"
419
419
  print("\n")
420
- self.__loading_animation("Logging in as Trainer", 0.6)
420
+ print("Logging in as Trainer...")
421
421
  print("\n")
422
422
  else:
423
423
  self.__mode = "apply"
@@ -464,7 +464,7 @@ class DLM:
464
464
  print(f"\033[{lines}A", end="")
465
465
 
466
466
  @staticmethod
467
- # loading animation for bot thought process
467
+ # loading animation for bot thought process (deprecated in favor for readability on production)
468
468
  def __loading_animation(user_input, duration): # no return, void
469
469
  for seconds in range(0, 3):
470
470
  print(f"{'\033[33m'}\r{user_input}{'.' * (seconds + 1)} {'\033[0m'}", end="", flush=True)
@@ -615,7 +615,7 @@ class DLM:
615
615
  else:
616
616
  print(
617
617
  f"{'\033[33m'}The user starts their query with \"{interrogative_start.title()}\" and they are asking about \"{" ".join(identifier).title()}\".{'\033[0m'}")
618
- self.__loading_animation("Let me think about this carefully", 0.8)
618
+ print("Let me think about this carefully...")
619
619
 
620
620
  for s in special_start:
621
621
  for u in filtered_query.split():
@@ -636,7 +636,7 @@ class DLM:
636
636
  print(
637
637
  f"{'\033[33m'}Furthermore, an in-depth vector analysis revealed a similarity percentage of {int(self.__nlp_similarity_value * 100)}%.{'\033[0m'}")
638
638
  print(
639
- f"{self.__loading_animation("Hmm", 0.8) or ''}{'\033[33m'}I don't think I know the answer.{'\033[0m'}")
639
+ f"{'Hmm...' or ''}{'\033[33m'}I don't think I know the answer.{'\033[0m'}")
640
640
  self.__unsure_while_thinking = True
641
641
  else:
642
642
  self.__unsure_while_thinking = False
@@ -647,8 +647,8 @@ class DLM:
647
647
  f"This is because when I did a sequence similarity calculation to one of the closest match in my database, I found it to be {int(highest_similarity * 100)}% similar.")
648
648
  if spacy_proceed:
649
649
  print(
650
- f"Additionally, doing a more in-depth vector NLP analysis resulted in {int(self.__nlp_similarity_value * 100)}% similarity. Although there are room for error, we will see.{'\033[0m'}")
651
- self.__loading_animation("Let me recall that answer", 0.8)
650
+ f"Additionally, doing a more in-depth vector NLP analysis resulted in {int(self.__nlp_similarity_value * 100)}% similarity. Although there is room for error, we will see.{'\033[0m'}")
651
+ print("Let me recall that answer...")
652
652
  print("\n")
653
653
  elif self.__model == "compute":
654
654
  perform_advanced_CoT(self, filtered_query, display_thought)
@@ -920,12 +920,10 @@ class DLM:
920
920
  self.__query = input("Empty input is unacceptable. Please enter something: ")
921
921
 
922
922
  self.__set_sentiment_tone(self.__query) # sets global variable sentiment tone
923
- while self.__refuse_to_respond:
923
+ if self.__refuse_to_respond:
924
924
  print()
925
- self.__query = input(random.choice(self.__refuse_to_respond_statements) + "\nTry again: ")
926
- while self.__query is None or self.__query == "":
927
- self.__query = input("Empty input is unacceptable. Please enter something: ")
928
- self.__set_sentiment_tone(self.__query)
925
+ print(random.choice(self.__refuse_to_respond_statements))
926
+ return
929
927
 
930
928
  # auto model choose using HuggingFace
931
929
  if self.__mode != "learn":
@@ -985,7 +983,7 @@ class DLM:
985
983
 
986
984
  if self.__try_memory:
987
985
  if display_thought:
988
- self.__loading_animation(f"Let me put this into my memory model, maybe it wasn't a mathematical query", 0.5)
986
+ print(f"Let me put this into my memory model, maybe it wasn't a mathematical query...")
989
987
  self.__model = "memory"
990
988
  self.__generate_thought(filtered_query, best_match_question, best_match_answer, highest_similarity, display_thought)
991
989
  self.__try_memory = False
@@ -1031,7 +1029,7 @@ class DLM:
1031
1029
  else: # only executes when in apply mode and bot cannot find the answer
1032
1030
  if self.__try_compute:
1033
1031
  if display_thought:
1034
- self.__loading_animation(f"Let me put this into my computation model, maybe it was a mathematical query", 0.5)
1032
+ print(f"Let me put this into my computation model, maybe it was a mathematical query...")
1035
1033
  self.__model = "compute"
1036
1034
  self.__try_compute = True
1037
1035
  self.__generate_thought(filtered_query, best_match_question, best_match_answer, highest_similarity,
@@ -114,21 +114,15 @@ def geometric_calculation(self, filtered_query, display_thought): # returns flo
114
114
  # if allowed, display the inner thought process
115
115
  obj_name = object_intel[1]
116
116
  if display_thought:
117
- self._DLM__loading_animation(f"It seems that the user wants to compute the {' of a '.join(object_intel)}", 0.5)
117
+ print(f"It seems that the user wants to compute the {' of a '.join(object_intel)}")
118
118
  if height_value is not None:
119
- self._DLM__loading_animation(
120
- f"* The user has mentioned that the height of the {obj_name} object is {height_value}", 0.4)
119
+ print(f"* The user has mentioned that the height of the {obj_name} object is {height_value}")
121
120
  else:
122
- self._DLM__loading_animation(
123
- f"* The {object_intel[1]} object has no height associated with it, so moving on", 0.4)
121
+ print(f"* The {object_intel[1]} object has no height associated with it, so moving on")
124
122
  if len(other_values) > 0:
125
- self._DLM__loading_animation(
126
- f"* Additional numerical values associated with the dimensions of the {obj_name} object is {' and '.join(str(v) for v in other_values)}",
127
- 0.4)
123
+ print(f"* Additional numerical values associated with the dimensions of the {obj_name} object is {' and '.join(str(v) for v in other_values)}")
128
124
  else:
129
- self._DLM__loading_animation(
130
- f"* No additional numerical values associated with the dimensions of the {obj_name} were given",
131
- 0.4)
125
+ print(f"* No additional numerical values associated with the dimensions of the {obj_name} were given")
132
126
 
133
127
  # Now iterate through the geometric identifier list, find the correct object, and then find its formula, then plug compute
134
128
  formula = self._DLM__geometric_calculation_identifiers[obj_name]["formula"]
@@ -212,9 +206,8 @@ def perform_advanced_CoT(self, filtered_query, display_thought): # no return, v
212
206
  if display_thought:
213
207
  print(
214
208
  f"{'\033[33m'}I am presented with a more involved query asking me to do some form of computation{'\033[0m'}")
215
- self._DLM__loading_animation("Let me think about this carefully and break it down so that I can solve it", 0.8)
216
- self._DLM__loading_animation(f"Ive trimmed away any extra words so Im focusing on \"{filtered_query}\" now",
217
- 0.8)
209
+ print("Let me think about this carefully and break it down so that I can solve it")
210
+ print(f"I've trimmed away any extra words so I'm focusing on \"{filtered_query}\" now")
218
211
 
219
212
  # Have the bot pick out names mentioned (in order) using SpaCy and NLTK (for maximum coverage)
220
213
  for ent in doc.ents:
@@ -408,30 +401,22 @@ def perform_advanced_CoT(self, filtered_query, display_thought): # no return, v
408
401
  '=' not in operands_mentioned and num_mentioned.__len__() < 2)): # don't compute if parts are missing
409
402
  if (not self._DLM__try_compute):
410
403
  if display_thought:
411
- print(f"{self._DLM__loading_animation('Hmm', 0.8) or '' if display_thought else ''}{'\033[33m'}It looks like some essential details are missing, so I can’t complete this calculation right now.{'\033[0m'}")
404
+ print(f"{'Hmm...' or '' if display_thought else ''}{'\033[33m'}It looks like some essential details are missing, so I can’t complete this calculation right now.{'\033[0m'}")
412
405
  self._DLM__try_memory = True
413
406
  else:
414
- self._DLM__loading_animation('Hmm', 0.8)
407
+ print("Hmm...")
415
408
  else: # else, the bot needs to explain what it has tokenized
416
409
  if display_thought:
417
- self._DLM__loading_animation(
418
- f"1.) I see {', '.join(persons_mentioned) if persons_mentioned.__len__() >= 1 else 'no one'} mentioned as a person name; "
419
- f"{'they’re likely key to this problem' if persons_mentioned.__len__() >= 1 else 'moving on'}", 0.2)
420
- self._DLM__loading_animation(
421
- f"2.) Moreover, I see {', '.join(items_mentioned) if items_mentioned.__len__() >= 1 else 'no items'} mentioned as proper nouns; "
422
- f"{'this might be a key thing to this problem' if items_mentioned.__len__() >= 1 else 'moving on'}",
423
- 0.2)
410
+ print(f"1.) I see {', '.join(persons_mentioned) if persons_mentioned.__len__() >= 1 else 'no one'} mentioned as a person name; "
411
+ f"{'they’re likely key to this problem' if persons_mentioned.__len__() >= 1 else 'moving on'}")
412
+ print(f"2.) Moreover, I see {', '.join(items_mentioned) if items_mentioned.__len__() >= 1 else 'no items'} mentioned as proper nouns; "
413
+ f"{'this might be a key thing to this problem' if items_mentioned.__len__() >= 1 else 'moving on'}")
424
414
  if is_geometric_query:
425
- self._DLM__loading_animation(f"3.) This is a geometric problem and I have already computed the answer",
426
- 0.2)
415
+ print(f"3.) This is a geometric problem and I have already computed the answer")
427
416
  else:
428
- self._DLM__loading_animation(
429
- f"3.) I’ve also identified the numbers {' and '.join(num_mentioned)} that I need to compute with",
430
- 0.2)
431
- self._DLM__loading_animation(
432
- f"4.) I see the keywords \"{'\" and \"'.join(keywords_mentioned)}\", meaning I need to perform a \"{'\" and \"'.join(operands_mentioned)}\" operation for this query; I’ll use that to guide my calculation",
433
- 0.2)
434
- self._DLM__loading_animation("Now I have the parts, so let me put it all together and solve", 0.3)
417
+ print(f"3.) I’ve also identified the numbers {' and '.join(num_mentioned)} that I need to compute with")
418
+ print(f"4.) I see the keywords \"{'\" and \"'.join(keywords_mentioned)}\", meaning I need to perform a \"{'\" and \"'.join(operands_mentioned)}\" operation for this query; I’ll use that to guide my calculation")
419
+ print("Now I have the parts, so let me put it all together and solve")
435
420
 
436
421
  # Finally compute it and then give the response (if there is any)
437
422
  # move "originally" numbers to the front
@@ -542,9 +527,7 @@ def perform_advanced_CoT(self, filtered_query, display_thought): # no return, v
542
527
  if source_key and target_key:
543
528
  result = (num0 * self._DLM__units[source_key]) / self._DLM__units[target_key]
544
529
  if display_thought:
545
- self._DLM__loading_animation(
546
- f"I need to take {num0} and multiply it by {self._DLM__units[source_key]}. Finally, I divide by {self._DLM__units[target_key]} and I got my answer",
547
- 0.2)
530
+ print(f"I need to take {num0} and multiply it by {self._DLM__units[source_key]}. Finally, I divide by {self._DLM__units[target_key]} and I got my answer")
548
531
  expr = f"{num_mentioned[0]} {source_key}(s) ==> {round(result, 2)} {target_key}(s)"
549
532
  print(f"{'\033[34m'}Conversion Answer: {expr} {'\033[0m'}")
550
533
  self._DLM__successfully_computed = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dynamic-learning-model
3
- Version: 3.3.6.1
3
+ Version: 3.4.1
4
4
  Summary: A Dynamic Learning Model for processing NLP queries using hybrid AI and reasoning.
5
5
  Home-page: https://github.com/VigneshT24/Dynamic_Learning_Model
6
6
  Author: Vignesh Thondikulam
@@ -5,7 +5,7 @@ with open('README.md', 'r', encoding='utf-8') as f:
5
5
 
6
6
  setup(
7
7
  name='dynamic-learning-model',
8
- version='3.3.6.1',
8
+ version='3.4.1',
9
9
  author='Vignesh Thondikulam',
10
10
  author_email='vignesh.tho2006@gmail.com',
11
11
  description='A Dynamic Learning Model for processing NLP queries using hybrid AI and reasoning.',