dynamic-learning-model 3.4.1__tar.gz → 3.4.3__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.
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/PKG-INFO +1 -1
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/dlm/DLM.py +21 -23
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/dlm/DLM_Compute_Model.py +13 -13
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/dynamic_learning_model.egg-info/PKG-INFO +1 -1
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/setup.py +1 -1
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/LICENSE +0 -0
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/README.md +0 -0
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/dlm/DLM_Memory_Model.py +0 -0
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/dlm/__init__.py +0 -0
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/dynamic_learning_model.egg-info/SOURCES.txt +0 -0
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/dynamic_learning_model.egg-info/dependency_links.txt +0 -0
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/dynamic_learning_model.egg-info/requires.txt +0 -0
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/dynamic_learning_model.egg-info/top_level.txt +0 -0
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/pyproject.toml +0 -0
- {dynamic_learning_model-3.4.1 → dynamic_learning_model-3.4.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dynamic-learning-model
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.3
|
|
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
|
|
@@ -399,7 +399,7 @@ class DLM:
|
|
|
399
399
|
if mode.lower() == "learn":
|
|
400
400
|
# trainers must understand these rules as DLM can generate bad responses if these instructions are neglected
|
|
401
401
|
print(
|
|
402
|
-
f"\n\
|
|
402
|
+
f"\n\nMAKE SURE TO UNDERSTAND THE FOLLOWING ANSWER FORMAT EXPECTED FOR EACH CATEGORY FOR THE BOT TO LEARN ACCURATELY:\n")
|
|
403
403
|
print("*'yesno': Make sure to start your answer responses with \"yes\" or \"no\" ONLY")
|
|
404
404
|
print(
|
|
405
405
|
"*'process': Each answer must have three steps for your responses, separated by \";\" (semicolon)")
|
|
@@ -467,7 +467,7 @@ class DLM:
|
|
|
467
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
|
-
print(f"
|
|
470
|
+
print(f"\r{user_input}{'.' * (seconds + 1)}", end="", flush=True)
|
|
471
471
|
time.sleep(duration)
|
|
472
472
|
print("\n")
|
|
473
473
|
|
|
@@ -588,13 +588,13 @@ class DLM:
|
|
|
588
588
|
print("\nThought Process (Yellow):")
|
|
589
589
|
if filtered_query is None or filtered_query == "":
|
|
590
590
|
print(
|
|
591
|
-
f"
|
|
591
|
+
f"I couldn't pick out any context or clear topic. If I see a match in my database I will respond with that, or else I have no clue!")
|
|
592
592
|
else:
|
|
593
593
|
sentiment_tone = self.__tone.split()
|
|
594
594
|
|
|
595
595
|
if self.__tone != "":
|
|
596
596
|
print(
|
|
597
|
-
f"
|
|
597
|
+
f"Right off the bat, the user seems quite {sentiment_tone[0]} or {sentiment_tone[1]} by their query tone. Hopefully I won't disappoint!")
|
|
598
598
|
if self.__model == "compute":
|
|
599
599
|
perform_advanced_CoT(self, filtered_query, display_thought)
|
|
600
600
|
else:
|
|
@@ -611,10 +611,10 @@ class DLM:
|
|
|
611
611
|
|
|
612
612
|
if " ".join(identifier) == "":
|
|
613
613
|
print(
|
|
614
|
-
f"
|
|
614
|
+
f"The user starts their query with \"{interrogative_start.title()}\", but I couldn't pick out a clear topic or context.")
|
|
615
615
|
else:
|
|
616
616
|
print(
|
|
617
|
-
f"
|
|
617
|
+
f"The user starts their query with \"{interrogative_start.title()}\" and they are asking about \"{" ".join(identifier).title()}\".")
|
|
618
618
|
print("Let me think about this carefully...")
|
|
619
619
|
|
|
620
620
|
for s in special_start:
|
|
@@ -624,30 +624,30 @@ class DLM:
|
|
|
624
624
|
if (s_input.vector_norm != 0 and u_input.vector_norm != 0) and (
|
|
625
625
|
s_input.similarity(u_input) > 0.60):
|
|
626
626
|
print(
|
|
627
|
-
f"
|
|
627
|
+
f"It seems like they want a {s} of \"{" ".join(identifier).title()}\".")
|
|
628
628
|
|
|
629
629
|
self.__semantic_similarity(self.__special_stripped_query, best_match_question)
|
|
630
630
|
spacy_proceed = self.__nlp_similarity_value is not None
|
|
631
631
|
if (best_match_answer is None) or (
|
|
632
632
|
highest_similarity < 0.65 and (spacy_proceed and self.__nlp_similarity_value < 0.85)):
|
|
633
633
|
print(
|
|
634
|
-
f"
|
|
634
|
+
f"The closest match is only {int(highest_similarity * 100)}% similar when I used sequence matching.")
|
|
635
635
|
if spacy_proceed:
|
|
636
636
|
print(
|
|
637
|
-
f"
|
|
637
|
+
f"Furthermore, an in-depth vector analysis revealed a similarity percentage of {int(self.__nlp_similarity_value * 100)}%.")
|
|
638
638
|
print(
|
|
639
|
-
f"{'Hmm...' or ''}
|
|
639
|
+
f"{'Hmm...' or ''}I don't think I know the answer.")
|
|
640
640
|
self.__unsure_while_thinking = True
|
|
641
641
|
else:
|
|
642
642
|
self.__unsure_while_thinking = False
|
|
643
643
|
DB_identifier = get_specific_question(self, best_match_answer)
|
|
644
644
|
print(
|
|
645
|
-
f"
|
|
645
|
+
f"Yes! I do remember learning about \"{DB_identifier}\" and I might have the right answer!")
|
|
646
646
|
print(
|
|
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 is room for error, we will see.
|
|
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.")
|
|
651
651
|
print("Let me recall that answer...")
|
|
652
652
|
print("\n")
|
|
653
653
|
elif self.__model == "compute":
|
|
@@ -669,15 +669,13 @@ class DLM:
|
|
|
669
669
|
- Gracefully handles unrecognized categories or missing data.
|
|
670
670
|
"""
|
|
671
671
|
identifier = get_category(self, best_match_question)
|
|
672
|
-
BLUE = '\033[34m'
|
|
673
|
-
RESET = '\033[0m'
|
|
674
672
|
|
|
675
673
|
if identifier is None:
|
|
676
674
|
print("Sorry, I encountered an error on my end. Please try again later.")
|
|
677
675
|
return
|
|
678
676
|
|
|
679
677
|
if identifier == "generic":
|
|
680
|
-
print(f"\n{
|
|
678
|
+
print(f"\n{best_match_answer}\n")
|
|
681
679
|
|
|
682
680
|
elif identifier == "yesno":
|
|
683
681
|
affirmative_templates = [
|
|
@@ -741,7 +739,7 @@ class DLM:
|
|
|
741
739
|
else:
|
|
742
740
|
best_match_answer = best_match_answer.replace("yes ", "", 1)
|
|
743
741
|
response = template.format(best_match_answer)
|
|
744
|
-
print(f"\n{
|
|
742
|
+
print(f"\n{response}\n")
|
|
745
743
|
|
|
746
744
|
elif identifier == "process": # when training, make sure there are only 3 steps for "process"
|
|
747
745
|
templates = [
|
|
@@ -758,7 +756,7 @@ class DLM:
|
|
|
758
756
|
]
|
|
759
757
|
steps = best_match_answer.split("; ") # steps must be separated by a semicolon
|
|
760
758
|
response = random.choice(templates).format(*steps[:3])
|
|
761
|
-
print(f"\n{
|
|
759
|
+
print(f"\n{response}\n")
|
|
762
760
|
|
|
763
761
|
elif identifier == "definition":
|
|
764
762
|
# extract just the term by filtering out common definition triggers
|
|
@@ -790,7 +788,7 @@ class DLM:
|
|
|
790
788
|
"You can think of \"{0}\" as {1}"
|
|
791
789
|
]
|
|
792
790
|
response = random.choice(templates).format(term, best_match_answer)
|
|
793
|
-
print(f"\n{
|
|
791
|
+
print(f"\n{response}\n")
|
|
794
792
|
|
|
795
793
|
elif identifier == "deadline":
|
|
796
794
|
raw = best_match_question
|
|
@@ -823,7 +821,7 @@ class DLM:
|
|
|
823
821
|
"The cutoff for \"{0}\" is {1}"
|
|
824
822
|
]
|
|
825
823
|
response = random.choice(templates).format(term, best_match_answer)
|
|
826
|
-
print(f"\n{
|
|
824
|
+
print(f"\n{response}\n")
|
|
827
825
|
|
|
828
826
|
elif identifier == "location":
|
|
829
827
|
templates = [
|
|
@@ -844,7 +842,7 @@ class DLM:
|
|
|
844
842
|
]
|
|
845
843
|
best_match_answer = best_match_answer.lower()
|
|
846
844
|
response = random.choice(templates).format(best_match_answer)
|
|
847
|
-
print(f"\n{
|
|
845
|
+
print(f"\n{response}\n")
|
|
848
846
|
|
|
849
847
|
elif identifier == "eligibility":
|
|
850
848
|
templates = [
|
|
@@ -866,7 +864,7 @@ class DLM:
|
|
|
866
864
|
]
|
|
867
865
|
best_match_answer = best_match_answer.lower()
|
|
868
866
|
response = random.choice(templates).format(best_match_answer)
|
|
869
|
-
print(f"\n{
|
|
867
|
+
print(f"\n{response}\n")
|
|
870
868
|
|
|
871
869
|
else:
|
|
872
870
|
print("Cannot retrieve and generate response due to data in unfamiliar category. Please try again later.")
|
|
@@ -1035,10 +1033,10 @@ class DLM:
|
|
|
1035
1033
|
self.__generate_thought(filtered_query, best_match_question, best_match_answer, highest_similarity,
|
|
1036
1034
|
display_thought)
|
|
1037
1035
|
if not self.__successfully_computed:
|
|
1038
|
-
print(f"{
|
|
1036
|
+
print(f"{random.choice(self.__fallback_responses)}")
|
|
1039
1037
|
self.__try_compute = False
|
|
1040
1038
|
self.__successfully_computed = False
|
|
1041
1039
|
else:
|
|
1042
|
-
print(f"{
|
|
1040
|
+
print(f"{random.choice(self.__fallback_responses)}")
|
|
1043
1041
|
self.__try_compute = False
|
|
1044
1042
|
self.__try_memory = False
|
|
@@ -164,10 +164,10 @@ def geometric_calculation(self, filtered_query, display_thought): # returns flo
|
|
|
164
164
|
except Exception as e:
|
|
165
165
|
if display_thought:
|
|
166
166
|
print(
|
|
167
|
-
f"
|
|
167
|
+
f"Unable to compute the {object_intel[0]} of the {obj_name} due to missing or mismatched values")
|
|
168
168
|
else:
|
|
169
169
|
print(
|
|
170
|
-
f"
|
|
170
|
+
f"Unable to compute the {object_intel[0]} of the {obj_name} due to missing or mismatched values")
|
|
171
171
|
return None
|
|
172
172
|
|
|
173
173
|
|
|
@@ -205,7 +205,7 @@ def perform_advanced_CoT(self, filtered_query, display_thought): # no return, v
|
|
|
205
205
|
|
|
206
206
|
if display_thought:
|
|
207
207
|
print(
|
|
208
|
-
f"
|
|
208
|
+
f"I am presented with a more involved query asking me to do some form of computation")
|
|
209
209
|
print("Let me think about this carefully and break it down so that I can solve it")
|
|
210
210
|
print(f"I've trimmed away any extra words so I'm focusing on \"{filtered_query}\" now")
|
|
211
211
|
|
|
@@ -401,7 +401,7 @@ def perform_advanced_CoT(self, filtered_query, display_thought): # no return, v
|
|
|
401
401
|
'=' not in operands_mentioned and num_mentioned.__len__() < 2)): # don't compute if parts are missing
|
|
402
402
|
if (not self._DLM__try_compute):
|
|
403
403
|
if display_thought:
|
|
404
|
-
print(f"{'Hmm...' or '' if display_thought else ''}
|
|
404
|
+
print(f"{'Hmm...' or '' if display_thought else ''}It looks like some essential details are missing, so I can't complete this calculation right now.")
|
|
405
405
|
self._DLM__try_memory = True
|
|
406
406
|
else:
|
|
407
407
|
print("Hmm...")
|
|
@@ -451,7 +451,7 @@ def perform_advanced_CoT(self, filtered_query, display_thought): # no return, v
|
|
|
451
451
|
|
|
452
452
|
# geometric problem
|
|
453
453
|
if is_geometric_query:
|
|
454
|
-
print(f"
|
|
454
|
+
print(f"Geometric Answer: {geometric_ans}")
|
|
455
455
|
self._DLM__successfully_computed = True
|
|
456
456
|
# conversion problem
|
|
457
457
|
elif len(num_mentioned) == 1 and len(operands_mentioned) == 1:
|
|
@@ -529,12 +529,12 @@ def perform_advanced_CoT(self, filtered_query, display_thought): # no return, v
|
|
|
529
529
|
if display_thought:
|
|
530
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")
|
|
531
531
|
expr = f"{num_mentioned[0]} {source_key}(s) ==> {round(result, 2)} {target_key}(s)"
|
|
532
|
-
print(f"
|
|
532
|
+
print(f"Conversion Answer: {expr}")
|
|
533
533
|
self._DLM__successfully_computed = True
|
|
534
534
|
else:
|
|
535
|
-
print(f"
|
|
535
|
+
print(f"Could not identify both source and target units.")
|
|
536
536
|
except SyntaxError:
|
|
537
|
-
print("
|
|
537
|
+
print("Oops! I still mix up conversions and arithmetic sometimes. Working on it!")
|
|
538
538
|
# regular arithmetic operations
|
|
539
539
|
elif len(num_mentioned) >= 2 and (
|
|
540
540
|
len(operands_mentioned) == (len(num_mentioned) - 1) or len(operands_mentioned) == 1):
|
|
@@ -555,15 +555,15 @@ def perform_advanced_CoT(self, filtered_query, display_thought): # no return, v
|
|
|
555
555
|
if "average" in filtered_query.lower():
|
|
556
556
|
expr = "(" + expr + ") / " + str(len(num_mentioned))
|
|
557
557
|
result /= len(num_mentioned)
|
|
558
|
-
print(f"
|
|
558
|
+
print(f"Arithmetic Answer: {expr} = {result}")
|
|
559
559
|
self._DLM__successfully_computed = True
|
|
560
560
|
except SyntaxError:
|
|
561
561
|
print(
|
|
562
|
-
f"
|
|
562
|
+
f"Something about that stumped me. I'll need to learn more to handle it properly.")
|
|
563
563
|
else:
|
|
564
564
|
self._DLM__successfully_computed = False
|
|
565
|
-
print(f"{
|
|
565
|
+
print(f"{random.choice(self._DLM__fallback_responses)}")
|
|
566
566
|
print(
|
|
567
|
-
f"
|
|
567
|
+
f"However, while I was trying to understand the math, I ran into \"{'" and "'.join(keywords_mentioned)}\", which I use to connect keywords to math operations.")
|
|
568
568
|
print(
|
|
569
|
-
f"
|
|
569
|
+
f"That might've confused me a bit, maybe try leaving one of those out or rephrase it to make it clearer?")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dynamic-learning-model
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.3
|
|
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.4.
|
|
8
|
+
version='3.4.3',
|
|
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.',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|