swarmauri_tool_dalechallreadability 0.6.0.dev154__py3-none-any.whl

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.
@@ -0,0 +1,66 @@
1
+ from swarmauri_core.ComponentBase import ComponentBase
2
+ import textstat
3
+ from typing import Any, Dict, List, Literal
4
+ from swarmauri_base.tools.ToolBase import ToolBase
5
+ from swarmauri_standard.tools.Parameter import Parameter
6
+
7
+
8
+ @ComponentBase.register_type(ToolBase, "DaleChallReadabilityTool")
9
+ class DaleChallReadabilityTool(ToolBase):
10
+ """
11
+ A tool for calculating the Dale-Chall Readability Score using the textstat library.
12
+
13
+ Attributes:
14
+ version (str): The version of the tool.
15
+ name (str): The name of the tool.
16
+ type (Literal["DaleChallReadabilityTool"]): The type of the tool.
17
+ description (str): A brief description of what the tool does.
18
+ """
19
+
20
+ version: str = "0.1.dev1"
21
+ name: str = "DaleChallReadabilityTool"
22
+ type: Literal["DaleChallReadabilityTool"] = "DaleChallReadabilityTool"
23
+ description: str = (
24
+ "Calculates the Dale-Chall Readability Score for a given text using textstat."
25
+ )
26
+ parameters: List[Parameter] = [
27
+ Parameter(
28
+ name="input_text",
29
+ type="string",
30
+ description="The input text for which to calculate the Dale-Chall Readability Score.",
31
+ required=True,
32
+ )
33
+ ]
34
+
35
+ def __call__(self, data: Dict[str, Any]) -> Dict[str, float]:
36
+ """
37
+ Executes the Dale-Chall Readability tool and returns the readability score using textstat.
38
+
39
+ Parameters:
40
+ data (Dict[str, Any]): The input data containing "input_text".
41
+
42
+ Returns:
43
+ Dict[str, float]: A dictionary containing the Dale-Chall Readability Score
44
+
45
+ Raises:
46
+ ValueError: If the input data is invalid.
47
+ """
48
+ if self.validate_input(data):
49
+ text = data["input_text"]
50
+ dale_chall_score = textstat.dale_chall_readability_score(text)
51
+ return {"dale_chall_score": dale_chall_score}
52
+ else:
53
+ raise ValueError("Invalid input for DaleChallReadabilityTool.")
54
+
55
+ def validate_input(self, data: Dict[str, Any]) -> bool:
56
+ """
57
+ Validates the input data.
58
+
59
+ Parameters:
60
+ data (Dict[str, Any]): The input data to be validated.
61
+
62
+ Returns:
63
+ bool: True if the input data is valid, False otherwise.
64
+ """
65
+ required_keys = ["input_text"]
66
+ return all(key in data for key in required_keys)
@@ -0,0 +1,13 @@
1
+ # swm_example_community_package/__init__.py
2
+ __version__ = "0.6.0.dev26"
3
+ __long_desc__ = """
4
+
5
+ # Swarmauri Example Plugin
6
+
7
+ This repository includes an example of a Swarmauri Plugin.
8
+
9
+ Visit us at: https://swarmauri.com
10
+ Follow us at: https://github.com/swarmauri
11
+ Star us at: https://github.com/swarmauri/swarmauri-sdk
12
+
13
+ """
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.3
2
+ Name: swarmauri_tool_dalechallreadability
3
+ Version: 0.6.0.dev154
4
+ Summary: Swarmauri Community Dale-Chall Readability Tool
5
+ License: Apache-2.0
6
+ Author: Jacob Stewart
7
+ Author-email: jacob@swarmauri.com
8
+ Requires-Python: >=3.10,<3.13
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Dist: swarmauri_base (>=0.6.0.dev154,<0.7.0)
15
+ Requires-Dist: swarmauri_core (>=0.6.0.dev154,<0.7.0)
16
+ Requires-Dist: textstat (>=0.7.4,<0.8.0)
17
+ Project-URL: Repository, http://github.com/swarmauri/swarmauri-sdk
18
+ Description-Content-Type: text/markdown
19
+
20
+ # Swarmauri Example Community Package
@@ -0,0 +1,6 @@
1
+ swarmauri_tool_dalechallreadability/__init__.py,sha256=0uVHnLXq2It40mWLDInnCTPWZurTYLYZsSMwQBwziQM,332
2
+ swarmauri_tool_dalechallreadability/DaleChallReadabilityTool.py,sha256=mEErX4ec3KXeXwP8LaoikMGUa-GlYVO8blkoROHkLcg,2427
3
+ swarmauri_tool_dalechallreadability-0.6.0.dev154.dist-info/entry_points.txt,sha256=l5wn5PRbhwm8Frb5PXk2vhF0Li9zziXuiVjB_JjKxFM,130
4
+ swarmauri_tool_dalechallreadability-0.6.0.dev154.dist-info/METADATA,sha256=Xr1sXncyW9RbPhYUQD7KC8ViRKtE_tce_es3vO7P9MQ,808
5
+ swarmauri_tool_dalechallreadability-0.6.0.dev154.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
6
+ swarmauri_tool_dalechallreadability-0.6.0.dev154.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.0.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [swarmauri.tools]
2
+ DaleChallReadabilityTool=swarmauri_tool_dalechallreadability.DaleChallReadabilityTool:DaleChallReadabilityTool
3
+