dynamic-learning-model 1.3.1__tar.gz → 1.4__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-1.3.1/dynamic_learning_model.egg-info → dynamic_learning_model-1.4}/PKG-INFO +1 -1
- {dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4}/dlm/DLM.py +82 -14
- {dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4/dynamic_learning_model.egg-info}/PKG-INFO +1 -1
- {dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4}/setup.py +1 -1
- {dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4}/LICENSE +0 -0
- {dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4}/README.md +0 -0
- {dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4}/dlm/__init__.py +0 -0
- {dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4}/dynamic_learning_model.egg-info/SOURCES.txt +0 -0
- {dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4}/dynamic_learning_model.egg-info/dependency_links.txt +0 -0
- {dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4}/dynamic_learning_model.egg-info/requires.txt +0 -0
- {dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4}/dynamic_learning_model.egg-info/top_level.txt +0 -0
- {dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4}/pyproject.toml +0 -0
- {dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4}/setup.cfg +0 -0
{dynamic_learning_model-1.3.1/dynamic_learning_model.egg-info → dynamic_learning_model-1.4}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dynamic-learning-model
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4
|
|
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
|
|
@@ -216,10 +216,11 @@ class DLM:
|
|
|
216
216
|
|
|
217
217
|
# to solve geometric problems (advanced CoT)
|
|
218
218
|
__geometric_calculation_identifiers = {
|
|
219
|
+
# 2D Shapes – Area
|
|
219
220
|
"triangle": {
|
|
220
|
-
"keywords": ["area", "triangle"],
|
|
221
|
-
"params": ["base", "height"],
|
|
222
|
-
"formula": lambda d: 0.5 * d["base"] * d["height"]
|
|
221
|
+
"keywords": ["area", "triangle"],
|
|
222
|
+
"params": ["base", "height"],
|
|
223
|
+
"formula": lambda d: 0.5 * d["base"] * d["height"]
|
|
223
224
|
},
|
|
224
225
|
"rectangle": {
|
|
225
226
|
"keywords": ["area", "rectangle"],
|
|
@@ -244,7 +245,49 @@ class DLM:
|
|
|
244
245
|
"circle": {
|
|
245
246
|
"keywords": ["area", "circle"],
|
|
246
247
|
"params": ["radius"],
|
|
247
|
-
"formula": lambda d:
|
|
248
|
+
"formula": lambda d: math.pi * math.pow(d["radius"], 2)
|
|
249
|
+
},
|
|
250
|
+
"ellipse": {
|
|
251
|
+
"keywords": ["area", "ellipse"],
|
|
252
|
+
"params": ["a", "b"],
|
|
253
|
+
"formula": lambda d: math.pi * d["a"] * d["b"]
|
|
254
|
+
},
|
|
255
|
+
"pentagon": {
|
|
256
|
+
"keywords": ["area", "pentagon"],
|
|
257
|
+
"params": ["side"],
|
|
258
|
+
"formula": lambda d: (1 / 4) * math.sqrt(5 * (5 + 2 * math.sqrt(5))) * math.pow(d["side"], 2)
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
# 3D Shapes – Volume
|
|
262
|
+
"cube": {
|
|
263
|
+
"keywords": ["volume", "cube"],
|
|
264
|
+
"params": ["side"],
|
|
265
|
+
"formula": lambda d: math.pow(d["side"], 3)
|
|
266
|
+
},
|
|
267
|
+
"rectangular prism": {
|
|
268
|
+
"keywords": ["volume", "rectangular prism"],
|
|
269
|
+
"params": ["length", "width", "height"],
|
|
270
|
+
"formula": lambda d: d["length"] * d["width"] * d["height"]
|
|
271
|
+
},
|
|
272
|
+
"cylinder": {
|
|
273
|
+
"keywords": ["volume", "cylinder"],
|
|
274
|
+
"params": ["radius", "height"],
|
|
275
|
+
"formula": lambda d: math.pi * math.pow(d["radius"], 2) * d["height"]
|
|
276
|
+
},
|
|
277
|
+
"cone": {
|
|
278
|
+
"keywords": ["volume", "cone"],
|
|
279
|
+
"params": ["radius", "height"],
|
|
280
|
+
"formula": lambda d: (1 / 3) * math.pi * math.pow(d["radius"], 2) * d["height"]
|
|
281
|
+
},
|
|
282
|
+
"sphere": {
|
|
283
|
+
"keywords": ["volume", "sphere"],
|
|
284
|
+
"params": ["radius"],
|
|
285
|
+
"formula": lambda d: (4 / 3) * math.pi * math.pow(d["radius"], 3)
|
|
286
|
+
},
|
|
287
|
+
"pyramid": {
|
|
288
|
+
"keywords": ["volume", "pyramid"],
|
|
289
|
+
"params": ["base_area", "height"],
|
|
290
|
+
"formula": lambda d: (1 / 3) * d["base_area"] * d["height"]
|
|
248
291
|
}
|
|
249
292
|
}
|
|
250
293
|
|
|
@@ -571,14 +614,14 @@ class DLM:
|
|
|
571
614
|
|
|
572
615
|
def __geometric_calculation(self, filtered_query, display_thought):
|
|
573
616
|
"""
|
|
574
|
-
Perform
|
|
617
|
+
Perform geometric problems that will be called inside perform_advanced_CoT
|
|
575
618
|
|
|
576
619
|
Parameters:
|
|
577
620
|
filtered_query (str): user query that has been filtered to have mostly computational details
|
|
578
621
|
display_thought (bool): Indicates whether the user wants to have the bot display its thought process or just give the answer
|
|
579
622
|
|
|
580
623
|
Returns:
|
|
581
|
-
float: The result after computing the
|
|
624
|
+
float: The result after computing the geometric calculation
|
|
582
625
|
|
|
583
626
|
Behavior:
|
|
584
627
|
- Search through query to find specific keywords like 'area' or 'volume'
|
|
@@ -638,17 +681,41 @@ class DLM:
|
|
|
638
681
|
other_values.append(float(token))
|
|
639
682
|
|
|
640
683
|
# find the object name and what to compute about the object
|
|
641
|
-
for
|
|
684
|
+
bigrams = [" ".join([lower_tokens[i], lower_tokens[i + 1]]) for i in range(len(lower_tokens) - 1)]
|
|
685
|
+
end_check = False
|
|
686
|
+
|
|
687
|
+
# first check bi-grams
|
|
688
|
+
for phrase in bigrams:
|
|
642
689
|
for obj in self.__geometric_calculation_identifiers:
|
|
643
|
-
# remove common endings for better matching
|
|
644
690
|
for ending in common_endings:
|
|
645
|
-
if
|
|
646
|
-
|
|
691
|
+
if phrase[0].endswith(ending):
|
|
692
|
+
phrase = phrase[: -len(ending)]
|
|
647
693
|
break
|
|
648
|
-
is_similar = difflib.get_close_matches(
|
|
694
|
+
is_similar = difflib.get_close_matches(phrase, [obj], n=1, cutoff=0.70)
|
|
649
695
|
if is_similar and is_similar[0] == obj:
|
|
650
696
|
object_intel.extend(self.__geometric_calculation_identifiers[obj]["keywords"])
|
|
651
|
-
|
|
697
|
+
end_check = True
|
|
698
|
+
break
|
|
699
|
+
if end_check:
|
|
700
|
+
break
|
|
701
|
+
|
|
702
|
+
# if no bi-gram match, check single words
|
|
703
|
+
if not end_check and not lower_tokens.__contains__("prism"):
|
|
704
|
+
for token in lower_tokens:
|
|
705
|
+
for obj in self.__geometric_calculation_identifiers:
|
|
706
|
+
for ending in common_endings:
|
|
707
|
+
if token.endswith(ending):
|
|
708
|
+
token = token[: -len(ending)]
|
|
709
|
+
break
|
|
710
|
+
is_similar = difflib.get_close_matches(token, [obj], n=1, cutoff=0.80)
|
|
711
|
+
if is_similar and is_similar[0] == obj:
|
|
712
|
+
object_intel.extend(self.__geometric_calculation_identifiers[obj]["keywords"])
|
|
713
|
+
end_check = True
|
|
714
|
+
break
|
|
715
|
+
if end_check:
|
|
716
|
+
break
|
|
717
|
+
|
|
718
|
+
# if allowed, display the inner thought process
|
|
652
719
|
obj_name = object_intel[1]
|
|
653
720
|
if display_thought:
|
|
654
721
|
self.__loadingAnimation(f"It seems that the user wants to compute the {' of a '.join(object_intel)}", 0.5)
|
|
@@ -666,11 +733,12 @@ class DLM:
|
|
|
666
733
|
params = self.__geometric_calculation_identifiers[obj_name]["params"]
|
|
667
734
|
|
|
668
735
|
formula_inputs = {} # all data gathered to compute geometry
|
|
669
|
-
|
|
736
|
+
|
|
737
|
+
# gather and plug in values into the formula
|
|
670
738
|
try:
|
|
671
739
|
if "height" in params:
|
|
672
740
|
formula_inputs["height"] = height_value
|
|
673
|
-
|
|
741
|
+
|
|
674
742
|
value_idx = 0 # count how many values to be added in formula_inputs
|
|
675
743
|
for param in params:
|
|
676
744
|
if param == "height":
|
{dynamic_learning_model-1.3.1 → dynamic_learning_model-1.4/dynamic_learning_model.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dynamic-learning-model
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4
|
|
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='1.
|
|
8
|
+
version='1.4',
|
|
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
|