swarmauri_tool_sentencecomplexity 0.9.0.dev4__tar.gz → 0.9.2.dev6__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.
@@ -0,0 +1,162 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_tool_sentencecomplexity
3
+ Version: 0.9.2.dev6
4
+ Summary: This repository includes an example of a First Class Swarmauri Example.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: swarmauri,tool,sentencecomplexity,repository,includes,example,first,class
8
+ Author: Jacob Stewart
9
+ Author-email: jacob@swarmauri.com
10
+ Requires-Python: >=3.10,<3.13
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Natural Language :: English
16
+ Classifier: Development Status :: 3 - Alpha
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
19
+ Requires-Dist: nltk (>=3.9.1)
20
+ Requires-Dist: swarmauri_base
21
+ Requires-Dist: swarmauri_core
22
+ Requires-Dist: swarmauri_standard
23
+ Description-Content-Type: text/markdown
24
+
25
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
26
+
27
+ <p align="center">
28
+ <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
29
+ <img src="https://img.shields.io/pypi/dm/swarmauri_tool_sentencecomplexity" alt="PyPI - Downloads"/></a>
30
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_sentencecomplexity/">
31
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_sentencecomplexity.svg"/></a>
32
+ <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
33
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_sentencecomplexity" alt="PyPI - Python Version"/></a>
34
+ <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
35
+ <img src="https://img.shields.io/pypi/l/swarmauri_tool_sentencecomplexity" alt="PyPI - License"/></a>
36
+ <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
37
+ <img src="https://img.shields.io/pypi/v/swarmauri_tool_sentencecomplexity?label=swarmauri_tool_sentencecomplexity&color=green" alt="PyPI - swarmauri_tool_sentencecomplexity"/></a>
38
+ </p>
39
+
40
+ ---
41
+
42
+ # Swarmauri Tool · Sentence Complexity
43
+
44
+ A Swarmauri NLP tool that evaluates sentence complexity by measuring average sentence length and estimating clause counts. Use it to monitor writing style, enforce readability requirements, or trigger editorial suggestions in agents.
45
+
46
+ - Tokenizes text with NLTK to compute sentence and word counts.
47
+ - Approximates clause density via punctuation and coordinating/subordinating conjunctions.
48
+ - Returns structured metrics suitable for analytics dashboards or conversational feedback.
49
+
50
+ ## Requirements
51
+
52
+ - Python 3.10 – 3.13.
53
+ - `nltk` (downloads the `punkt_tab` tokenizer data on first import).
54
+ - Core Swarmauri dependencies (`swarmauri_base`, `swarmauri_standard`, `pydantic`).
55
+
56
+ ## Installation
57
+
58
+ Choose the packaging workflow that matches your project; each command resolves the dependencies.
59
+
60
+ **pip**
61
+
62
+ ```bash
63
+ pip install swarmauri_tool_sentencecomplexity
64
+ ```
65
+
66
+ **Poetry**
67
+
68
+ ```bash
69
+ poetry add swarmauri_tool_sentencecomplexity
70
+ ```
71
+
72
+ **uv**
73
+
74
+ ```bash
75
+ # Add to the current project and update uv.lock
76
+ uv add swarmauri_tool_sentencecomplexity
77
+
78
+ # or install into the active environment without modifying pyproject.toml
79
+ uv pip install swarmauri_tool_sentencecomplexity
80
+ ```
81
+
82
+ > Tip: Pre-download the NLTK tokenizer resources in deployment images (`python -m nltk.downloader punkt_tab`) to avoid runtime network calls.
83
+
84
+ ## Quick Start
85
+
86
+ ```python
87
+ from swarmauri_tool_sentencecomplexity import SentenceComplexityTool
88
+
89
+ text = "This is a simple sentence. This is another sentence, with a clause."
90
+
91
+ complexity_tool = SentenceComplexityTool()
92
+ result = complexity_tool(text)
93
+
94
+ print(result)
95
+ # {
96
+ # 'average_sentence_length': 7.5,
97
+ # 'average_clauses_per_sentence': 1.5
98
+ # }
99
+ ```
100
+
101
+ The tool raises `ValueError` when the input text is empty or whitespace.
102
+
103
+ ## Usage Scenarios
104
+
105
+ ### Flag Long Sentences During Editing
106
+
107
+ ```python
108
+ from swarmauri_tool_sentencecomplexity import SentenceComplexityTool
109
+
110
+ complexity = SentenceComplexityTool()
111
+ article = Path("drafts/whitepaper.txt").read_text(encoding="utf-8")
112
+ metrics = complexity(article)
113
+
114
+ if metrics["average_sentence_length"] > 25:
115
+ print("Consider splitting long sentences to improve readability.")
116
+ ```
117
+
118
+ ### Integrate With a Swarmauri Agent for Style Coaching
119
+
120
+ ```python
121
+ from swarmauri_core.agent.Agent import Agent
122
+ from swarmauri_core.messages.HumanMessage import HumanMessage
123
+ from swarmauri_standard.tools.registry import ToolRegistry
124
+ from swarmauri_tool_sentencecomplexity import SentenceComplexityTool
125
+
126
+ registry = ToolRegistry()
127
+ registry.register(SentenceComplexityTool())
128
+ agent = Agent(tool_registry=registry)
129
+
130
+ message = HumanMessage(content="Analyze the complexity of: 'While the system scales, it may introduce latency delays.'")
131
+ response = agent.run(message)
132
+ print(response)
133
+ ```
134
+
135
+ ### Compare Versions of a Document Over Time
136
+
137
+ ```python
138
+ from swarmauri_tool_sentencecomplexity import SentenceComplexityTool
139
+
140
+ complexity = SentenceComplexityTool()
141
+ versions = {
142
+ "draft": open("draft.txt").read(),
143
+ "final": open("final.txt").read(),
144
+ }
145
+
146
+ for label, text in versions.items():
147
+ metrics = complexity(text)
148
+ print(f"{label}: {metrics['average_sentence_length']:.1f} words, {metrics['average_clauses_per_sentence']:.2f} clauses")
149
+ ```
150
+
151
+ Track whether edits are making the writing clearer or more complex.
152
+
153
+ ## Troubleshooting
154
+
155
+ - **`LookupError: Resource punkt_tab not found`** – Run `python -m nltk.downloader punkt_tab` before executing the tool, especially in offline environments.
156
+ - **Low clause counts for technical prose** – The heuristic relies on commas/semicolons and common conjunctions; adjust or extend the tool if you need domain-specific parsing.
157
+ - **Non-English text** – Tokenization models are optimized for English. Supply language-appropriate tokenizers before using the tool for other languages.
158
+
159
+ ## License
160
+
161
+ `swarmauri_tool_sentencecomplexity` is released under the Apache 2.0 License. See `LICENSE` for details.
162
+
@@ -0,0 +1,137 @@
1
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
2
+
3
+ <p align="center">
4
+ <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
5
+ <img src="https://img.shields.io/pypi/dm/swarmauri_tool_sentencecomplexity" alt="PyPI - Downloads"/></a>
6
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_sentencecomplexity/">
7
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_sentencecomplexity.svg"/></a>
8
+ <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
9
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_sentencecomplexity" alt="PyPI - Python Version"/></a>
10
+ <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
11
+ <img src="https://img.shields.io/pypi/l/swarmauri_tool_sentencecomplexity" alt="PyPI - License"/></a>
12
+ <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
13
+ <img src="https://img.shields.io/pypi/v/swarmauri_tool_sentencecomplexity?label=swarmauri_tool_sentencecomplexity&color=green" alt="PyPI - swarmauri_tool_sentencecomplexity"/></a>
14
+ </p>
15
+
16
+ ---
17
+
18
+ # Swarmauri Tool · Sentence Complexity
19
+
20
+ A Swarmauri NLP tool that evaluates sentence complexity by measuring average sentence length and estimating clause counts. Use it to monitor writing style, enforce readability requirements, or trigger editorial suggestions in agents.
21
+
22
+ - Tokenizes text with NLTK to compute sentence and word counts.
23
+ - Approximates clause density via punctuation and coordinating/subordinating conjunctions.
24
+ - Returns structured metrics suitable for analytics dashboards or conversational feedback.
25
+
26
+ ## Requirements
27
+
28
+ - Python 3.10 – 3.13.
29
+ - `nltk` (downloads the `punkt_tab` tokenizer data on first import).
30
+ - Core Swarmauri dependencies (`swarmauri_base`, `swarmauri_standard`, `pydantic`).
31
+
32
+ ## Installation
33
+
34
+ Choose the packaging workflow that matches your project; each command resolves the dependencies.
35
+
36
+ **pip**
37
+
38
+ ```bash
39
+ pip install swarmauri_tool_sentencecomplexity
40
+ ```
41
+
42
+ **Poetry**
43
+
44
+ ```bash
45
+ poetry add swarmauri_tool_sentencecomplexity
46
+ ```
47
+
48
+ **uv**
49
+
50
+ ```bash
51
+ # Add to the current project and update uv.lock
52
+ uv add swarmauri_tool_sentencecomplexity
53
+
54
+ # or install into the active environment without modifying pyproject.toml
55
+ uv pip install swarmauri_tool_sentencecomplexity
56
+ ```
57
+
58
+ > Tip: Pre-download the NLTK tokenizer resources in deployment images (`python -m nltk.downloader punkt_tab`) to avoid runtime network calls.
59
+
60
+ ## Quick Start
61
+
62
+ ```python
63
+ from swarmauri_tool_sentencecomplexity import SentenceComplexityTool
64
+
65
+ text = "This is a simple sentence. This is another sentence, with a clause."
66
+
67
+ complexity_tool = SentenceComplexityTool()
68
+ result = complexity_tool(text)
69
+
70
+ print(result)
71
+ # {
72
+ # 'average_sentence_length': 7.5,
73
+ # 'average_clauses_per_sentence': 1.5
74
+ # }
75
+ ```
76
+
77
+ The tool raises `ValueError` when the input text is empty or whitespace.
78
+
79
+ ## Usage Scenarios
80
+
81
+ ### Flag Long Sentences During Editing
82
+
83
+ ```python
84
+ from swarmauri_tool_sentencecomplexity import SentenceComplexityTool
85
+
86
+ complexity = SentenceComplexityTool()
87
+ article = Path("drafts/whitepaper.txt").read_text(encoding="utf-8")
88
+ metrics = complexity(article)
89
+
90
+ if metrics["average_sentence_length"] > 25:
91
+ print("Consider splitting long sentences to improve readability.")
92
+ ```
93
+
94
+ ### Integrate With a Swarmauri Agent for Style Coaching
95
+
96
+ ```python
97
+ from swarmauri_core.agent.Agent import Agent
98
+ from swarmauri_core.messages.HumanMessage import HumanMessage
99
+ from swarmauri_standard.tools.registry import ToolRegistry
100
+ from swarmauri_tool_sentencecomplexity import SentenceComplexityTool
101
+
102
+ registry = ToolRegistry()
103
+ registry.register(SentenceComplexityTool())
104
+ agent = Agent(tool_registry=registry)
105
+
106
+ message = HumanMessage(content="Analyze the complexity of: 'While the system scales, it may introduce latency delays.'")
107
+ response = agent.run(message)
108
+ print(response)
109
+ ```
110
+
111
+ ### Compare Versions of a Document Over Time
112
+
113
+ ```python
114
+ from swarmauri_tool_sentencecomplexity import SentenceComplexityTool
115
+
116
+ complexity = SentenceComplexityTool()
117
+ versions = {
118
+ "draft": open("draft.txt").read(),
119
+ "final": open("final.txt").read(),
120
+ }
121
+
122
+ for label, text in versions.items():
123
+ metrics = complexity(text)
124
+ print(f"{label}: {metrics['average_sentence_length']:.1f} words, {metrics['average_clauses_per_sentence']:.2f} clauses")
125
+ ```
126
+
127
+ Track whether edits are making the writing clearer or more complex.
128
+
129
+ ## Troubleshooting
130
+
131
+ - **`LookupError: Resource punkt_tab not found`** – Run `python -m nltk.downloader punkt_tab` before executing the tool, especially in offline environments.
132
+ - **Low clause counts for technical prose** – The heuristic relies on commas/semicolons and common conjunctions; adjust or extend the tool if you need domain-specific parsing.
133
+ - **Non-English text** – Tokenization models are optimized for English. Supply language-appropriate tokenizers before using the tool for other languages.
134
+
135
+ ## License
136
+
137
+ `swarmauri_tool_sentencecomplexity` is released under the Apache 2.0 License. See `LICENSE` for details.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "swarmauri_tool_sentencecomplexity"
3
- version = "0.9.0.dev4"
3
+ version = "0.9.2.dev6"
4
4
  description = "This repository includes an example of a First Class Swarmauri Example."
5
5
  license = "Apache-2.0"
6
6
  readme = "README.md"
@@ -11,6 +11,10 @@ classifiers = [
11
11
  "Programming Language :: Python :: 3.10",
12
12
  "Programming Language :: Python :: 3.11",
13
13
  "Programming Language :: Python :: 3.12",
14
+ "Natural Language :: English",
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
14
18
  ]
15
19
  authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
16
20
  dependencies = [
@@ -19,6 +23,16 @@ dependencies = [
19
23
  "swarmauri_base",
20
24
  "swarmauri_standard",
21
25
  ]
26
+ keywords = [
27
+ "swarmauri",
28
+ "tool",
29
+ "sentencecomplexity",
30
+ "repository",
31
+ "includes",
32
+ "example",
33
+ "first",
34
+ "class",
35
+ ]
22
36
 
23
37
  [tool.uv.sources]
24
38
  swarmauri_core = { workspace = true }
@@ -1,70 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: swarmauri_tool_sentencecomplexity
3
- Version: 0.9.0.dev4
4
- Summary: This repository includes an example of a First Class Swarmauri Example.
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.10
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Requires-Dist: nltk (>=3.9.1)
14
- Requires-Dist: swarmauri_base
15
- Requires-Dist: swarmauri_core
16
- Requires-Dist: swarmauri_standard
17
- Description-Content-Type: text/markdown
18
-
19
-
20
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
21
-
22
- <p align="center">
23
- <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
24
- <img src="https://img.shields.io/pypi/dm/swarmauri_tool_sentencecomplexity" alt="PyPI - Downloads"/></a>
25
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_sentencecomplexity/">
26
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_sentencecomplexity.svg"/></a>
27
- <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
28
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_sentencecomplexity" alt="PyPI - Python Version"/></a>
29
- <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
30
- <img src="https://img.shields.io/pypi/l/swarmauri_tool_sentencecomplexity" alt="PyPI - License"/></a>
31
- <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
32
- <img src="https://img.shields.io/pypi/v/swarmauri_tool_sentencecomplexity?label=swarmauri_tool_sentencecomplexity&color=green" alt="PyPI - swarmauri_tool_sentencecomplexity"/></a>
33
- </p>
34
-
35
- ---
36
-
37
- # Swarmauri Tool Sentencecomplexity
38
-
39
- A tool for evaluating sentence complexity based on average sentence length and the number of clauses.
40
-
41
- ## Installation
42
-
43
- ```bash
44
- pip install swarmauri_tool_sentencecomplexity
45
- ```
46
-
47
- ## Usage
48
- The SentenceComplexityTool analyzes text and returns metrics about sentence complexity.
49
-
50
- ```python
51
- from swarmauri.tools.sentencecomplexity import SentenceComplexityTool
52
-
53
- # Initialize the tool
54
- tool = SentenceComplexityTool()
55
-
56
- # Analyze text
57
- text = "This is a simple sentence. This is another sentence, with a clause."
58
- result = tool(text)
59
-
60
- print(result)
61
- # Output: {
62
- # 'average_sentence_length': 7.5,
63
- # 'average_clauses_per_sentence': 1.5
64
- # }
65
- ```
66
-
67
- ## Want to help?
68
-
69
- If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
70
-
@@ -1,51 +0,0 @@
1
-
2
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
3
-
4
- <p align="center">
5
- <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
6
- <img src="https://img.shields.io/pypi/dm/swarmauri_tool_sentencecomplexity" alt="PyPI - Downloads"/></a>
7
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_sentencecomplexity/">
8
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_sentencecomplexity.svg"/></a>
9
- <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
10
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_sentencecomplexity" alt="PyPI - Python Version"/></a>
11
- <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
12
- <img src="https://img.shields.io/pypi/l/swarmauri_tool_sentencecomplexity" alt="PyPI - License"/></a>
13
- <a href="https://pypi.org/project/swarmauri_tool_sentencecomplexity/">
14
- <img src="https://img.shields.io/pypi/v/swarmauri_tool_sentencecomplexity?label=swarmauri_tool_sentencecomplexity&color=green" alt="PyPI - swarmauri_tool_sentencecomplexity"/></a>
15
- </p>
16
-
17
- ---
18
-
19
- # Swarmauri Tool Sentencecomplexity
20
-
21
- A tool for evaluating sentence complexity based on average sentence length and the number of clauses.
22
-
23
- ## Installation
24
-
25
- ```bash
26
- pip install swarmauri_tool_sentencecomplexity
27
- ```
28
-
29
- ## Usage
30
- The SentenceComplexityTool analyzes text and returns metrics about sentence complexity.
31
-
32
- ```python
33
- from swarmauri.tools.sentencecomplexity import SentenceComplexityTool
34
-
35
- # Initialize the tool
36
- tool = SentenceComplexityTool()
37
-
38
- # Analyze text
39
- text = "This is a simple sentence. This is another sentence, with a clause."
40
- result = tool(text)
41
-
42
- print(result)
43
- # Output: {
44
- # 'average_sentence_length': 7.5,
45
- # 'average_clauses_per_sentence': 1.5
46
- # }
47
- ```
48
-
49
- ## Want to help?
50
-
51
- If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.