textutils-MB 1.0.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.
- textutils_mb-1.0.1/LICENSE +21 -0
- textutils_mb-1.0.1/PKG-INFO +69 -0
- textutils_mb-1.0.1/README.md +33 -0
- textutils_mb-1.0.1/pyproject.toml +33 -0
- textutils_mb-1.0.1/setup.cfg +4 -0
- textutils_mb-1.0.1/textutils/__init__.py +11 -0
- textutils_mb-1.0.1/textutils/casing/__init__.py +3 -0
- textutils_mb-1.0.1/textutils/casing/_casing.py +21 -0
- textutils_mb-1.0.1/textutils/counting/__init__.py +3 -0
- textutils_mb-1.0.1/textutils/counting/_counting.py +71 -0
- textutils_mb-1.0.1/textutils/tests/__init__.py +0 -0
- textutils_mb-1.0.1/textutils/tests/test_casing.py +28 -0
- textutils_mb-1.0.1/textutils/tests/test_counting.py +72 -0
- textutils_mb-1.0.1/textutils/tests/test_transform.py +27 -0
- textutils_mb-1.0.1/textutils/transform/__init__.py +3 -0
- textutils_mb-1.0.1/textutils/transform/_transform.py +21 -0
- textutils_mb-1.0.1/textutils_MB.egg-info/PKG-INFO +69 -0
- textutils_mb-1.0.1/textutils_MB.egg-info/SOURCES.txt +19 -0
- textutils_mb-1.0.1/textutils_MB.egg-info/dependency_links.txt +1 -0
- textutils_mb-1.0.1/textutils_MB.egg-info/requires.txt +6 -0
- textutils_mb-1.0.1/textutils_MB.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Martin-B74
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: textutils_MB
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: A lightweight Python library for common text-processing operations.
|
|
5
|
+
License: MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2026 Martin-B74
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
Requires-Python: >=3.9
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
33
|
+
Requires-Dist: black>=24.0; extra == "dev"
|
|
34
|
+
Requires-Dist: ruff>=0.3; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# About textutils
|
|
38
|
+
textutils is a lightweight, open-source Python library designed for quick and basic text processing.
|
|
39
|
+
|
|
40
|
+
## Available Functionality
|
|
41
|
+
* **`word_count(text)`**: Counts the total number of words in a given string.
|
|
42
|
+
* **`character_count(text)`**: Counts the total number of characters in a given string.
|
|
43
|
+
* **`reverse(text)`**: Reverses the input string.
|
|
44
|
+
* **`capitalize_words(text)`**: Capitalizes the first letter of every word in the text.
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
Here is a minimal example of how to use the library:
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
import textutils
|
|
51
|
+
|
|
52
|
+
sample_text = "hello world"
|
|
53
|
+
|
|
54
|
+
# Count words
|
|
55
|
+
print(textutils.word_count(sample_text)) # Output: 2
|
|
56
|
+
|
|
57
|
+
# Capitalize words
|
|
58
|
+
print(textutils.capitalize_words(sample_text)) # Output: Hello World
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Contributing
|
|
62
|
+
Contributions are welcome! If you would like to contribute, please follow these steps:
|
|
63
|
+
1. Fork the repository.
|
|
64
|
+
2. Create a new branch for your feature or bugfix.
|
|
65
|
+
3. Commit your changes with clear messages.
|
|
66
|
+
4. Push your branch and open a Pull Request.
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# About textutils
|
|
2
|
+
textutils is a lightweight, open-source Python library designed for quick and basic text processing.
|
|
3
|
+
|
|
4
|
+
## Available Functionality
|
|
5
|
+
* **`word_count(text)`**: Counts the total number of words in a given string.
|
|
6
|
+
* **`character_count(text)`**: Counts the total number of characters in a given string.
|
|
7
|
+
* **`reverse(text)`**: Reverses the input string.
|
|
8
|
+
* **`capitalize_words(text)`**: Capitalizes the first letter of every word in the text.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
Here is a minimal example of how to use the library:
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import textutils
|
|
15
|
+
|
|
16
|
+
sample_text = "hello world"
|
|
17
|
+
|
|
18
|
+
# Count words
|
|
19
|
+
print(textutils.word_count(sample_text)) # Output: 2
|
|
20
|
+
|
|
21
|
+
# Capitalize words
|
|
22
|
+
print(textutils.capitalize_words(sample_text)) # Output: Hello World
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Contributing
|
|
26
|
+
Contributions are welcome! If you would like to contribute, please follow these steps:
|
|
27
|
+
1. Fork the repository.
|
|
28
|
+
2. Create a new branch for your feature or bugfix.
|
|
29
|
+
3. Commit your changes with clear messages.
|
|
30
|
+
4. Push your branch and open a Pull Request.
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "textutils_MB"
|
|
7
|
+
version = "1.0.1"
|
|
8
|
+
description = "A lightweight Python library for common text-processing operations."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
dependencies = []
|
|
13
|
+
|
|
14
|
+
[project.optional-dependencies]
|
|
15
|
+
dev = [
|
|
16
|
+
"pytest>=8.0",
|
|
17
|
+
"pytest-cov>=5.0",
|
|
18
|
+
"black>=24.0",
|
|
19
|
+
"ruff>=0.3",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[tool.black]
|
|
23
|
+
line-length = 88
|
|
24
|
+
|
|
25
|
+
[tool.ruff]
|
|
26
|
+
line-length = 88
|
|
27
|
+
|
|
28
|
+
[tool.pytest.ini_options]
|
|
29
|
+
testpaths = ["textutils/tests"]
|
|
30
|
+
|
|
31
|
+
[tool.coverage.run]
|
|
32
|
+
branch = true
|
|
33
|
+
source = ["textutils"]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from textutils.casing import capitalize_words
|
|
2
|
+
from textutils.counting import character_count, phrase_count, word_count
|
|
3
|
+
from textutils.transform import reverse
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"capitalize_words",
|
|
7
|
+
"character_count",
|
|
8
|
+
"phrase_count",
|
|
9
|
+
"reverse",
|
|
10
|
+
"word_count",
|
|
11
|
+
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
def capitalize_words(text):
|
|
2
|
+
"""Capitalizes the first letter of every word in the text.
|
|
3
|
+
|
|
4
|
+
Parameters
|
|
5
|
+
----------
|
|
6
|
+
text : str
|
|
7
|
+
The string to capitalize.
|
|
8
|
+
|
|
9
|
+
Returns
|
|
10
|
+
-------
|
|
11
|
+
str
|
|
12
|
+
A new string with the first letter of each word capitalized.
|
|
13
|
+
|
|
14
|
+
Raises
|
|
15
|
+
------
|
|
16
|
+
TypeError
|
|
17
|
+
If text is not a string.
|
|
18
|
+
"""
|
|
19
|
+
if not isinstance(text, str):
|
|
20
|
+
raise TypeError("text must be a string")
|
|
21
|
+
return text.title()
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
def word_count(text):
|
|
2
|
+
"""Counts the total number of words in a given string.
|
|
3
|
+
|
|
4
|
+
Parameters
|
|
5
|
+
----------
|
|
6
|
+
text : str
|
|
7
|
+
The input string to be analyzed.
|
|
8
|
+
|
|
9
|
+
Returns
|
|
10
|
+
-------
|
|
11
|
+
int
|
|
12
|
+
The number of words contained in the text.
|
|
13
|
+
|
|
14
|
+
Raises
|
|
15
|
+
------
|
|
16
|
+
TypeError
|
|
17
|
+
If text is not a string.
|
|
18
|
+
"""
|
|
19
|
+
if not isinstance(text, str):
|
|
20
|
+
raise TypeError("text must be a string")
|
|
21
|
+
return len(text.split())
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def character_count(text):
|
|
25
|
+
"""Counts the total number of characters in a given string.
|
|
26
|
+
|
|
27
|
+
Parameters
|
|
28
|
+
----------
|
|
29
|
+
text : str
|
|
30
|
+
The input string to be analyzed.
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
-------
|
|
34
|
+
int
|
|
35
|
+
The total number of characters, including spaces and punctuation.
|
|
36
|
+
|
|
37
|
+
Raises
|
|
38
|
+
------
|
|
39
|
+
TypeError
|
|
40
|
+
If text is not a string.
|
|
41
|
+
"""
|
|
42
|
+
if not isinstance(text, str):
|
|
43
|
+
raise TypeError("text must be a string")
|
|
44
|
+
return len(text)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def phrase_count(text):
|
|
48
|
+
"""Counts the total number of phrases in a given string.
|
|
49
|
+
|
|
50
|
+
Parameters
|
|
51
|
+
----------
|
|
52
|
+
text : str
|
|
53
|
+
The input string to be analyzed.
|
|
54
|
+
|
|
55
|
+
Returns
|
|
56
|
+
-------
|
|
57
|
+
int
|
|
58
|
+
The total number of phrases.
|
|
59
|
+
|
|
60
|
+
Raises
|
|
61
|
+
------
|
|
62
|
+
TypeError
|
|
63
|
+
If text is not a string.
|
|
64
|
+
"""
|
|
65
|
+
if not isinstance(text, str):
|
|
66
|
+
raise TypeError("text must be a string")
|
|
67
|
+
c = 0
|
|
68
|
+
for i in text:
|
|
69
|
+
if i in ".!?":
|
|
70
|
+
c += 1
|
|
71
|
+
return c
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from textutils import capitalize_words
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# capitalize_words
|
|
7
|
+
@pytest.mark.parametrize(
|
|
8
|
+
"text, expected",
|
|
9
|
+
[
|
|
10
|
+
("hello world", "Hello World"),
|
|
11
|
+
("open source development", "Open Source Development"),
|
|
12
|
+
("python", "Python"),
|
|
13
|
+
("", ""),
|
|
14
|
+
(" ", " "),
|
|
15
|
+
("a", "A"),
|
|
16
|
+
("HELLO WORLD", "Hello World"),
|
|
17
|
+
("hElLo wOrLd", "Hello World"),
|
|
18
|
+
(" hello world ", " Hello World "),
|
|
19
|
+
],
|
|
20
|
+
)
|
|
21
|
+
def test_capitalize_words(text, expected):
|
|
22
|
+
assert capitalize_words(text) == expected
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@pytest.mark.parametrize("invalid_input", [None, 123, 45.6, ["hello"], {"a": 1}])
|
|
26
|
+
def test_capitalize_words_invalid_input(invalid_input):
|
|
27
|
+
with pytest.raises(TypeError):
|
|
28
|
+
capitalize_words(invalid_input)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from textutils import character_count, phrase_count, word_count
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# word_count
|
|
7
|
+
@pytest.mark.parametrize(
|
|
8
|
+
"text, expected",
|
|
9
|
+
[
|
|
10
|
+
("Hello", 1),
|
|
11
|
+
("Hello World", 2),
|
|
12
|
+
("Open Source Development", 3),
|
|
13
|
+
("", 0),
|
|
14
|
+
(" ", 0),
|
|
15
|
+
("Hello World", 2),
|
|
16
|
+
(" Hello World ", 2),
|
|
17
|
+
("\tHello\nWorld\t", 2),
|
|
18
|
+
],
|
|
19
|
+
)
|
|
20
|
+
def test_word_count(text, expected):
|
|
21
|
+
assert word_count(text) == expected
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@pytest.mark.parametrize("invalid_input", [None, 123, ["Hello"], {"a": 1}])
|
|
25
|
+
def test_word_count_invalid_input(invalid_input):
|
|
26
|
+
with pytest.raises(TypeError):
|
|
27
|
+
word_count(invalid_input)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# character_count
|
|
31
|
+
@pytest.mark.parametrize(
|
|
32
|
+
"text, expected",
|
|
33
|
+
[
|
|
34
|
+
("Hello", 5),
|
|
35
|
+
("Hello World!", 12),
|
|
36
|
+
("", 0),
|
|
37
|
+
(" ", 1),
|
|
38
|
+
(" ", 3),
|
|
39
|
+
("!", 1),
|
|
40
|
+
],
|
|
41
|
+
)
|
|
42
|
+
def test_character_count(text, expected):
|
|
43
|
+
assert character_count(text) == expected
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@pytest.mark.parametrize("invalid_input", [None, 123, ["Hello"], {"a": 1}])
|
|
47
|
+
def test_character_count_invalid_input(invalid_input):
|
|
48
|
+
with pytest.raises(TypeError):
|
|
49
|
+
character_count(invalid_input)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# phrase_count
|
|
53
|
+
@pytest.mark.parametrize(
|
|
54
|
+
"text, expected",
|
|
55
|
+
[
|
|
56
|
+
("Hello world.", 1),
|
|
57
|
+
("Hello! How are you? Fine.", 3),
|
|
58
|
+
("", 0),
|
|
59
|
+
("Hello world without punctuation", 0),
|
|
60
|
+
("...", 3),
|
|
61
|
+
("?!.", 3),
|
|
62
|
+
(" ", 0),
|
|
63
|
+
],
|
|
64
|
+
)
|
|
65
|
+
def test_phrase_count(text, expected):
|
|
66
|
+
assert phrase_count(text) == expected
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@pytest.mark.parametrize("invalid_input", [None, 123, ["Hello"], {"a": 1}])
|
|
70
|
+
def test_phrase_count_invalid_input(invalid_input):
|
|
71
|
+
with pytest.raises(TypeError):
|
|
72
|
+
phrase_count(invalid_input)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from textutils import reverse
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# reverse
|
|
7
|
+
@pytest.mark.parametrize(
|
|
8
|
+
"text, expected",
|
|
9
|
+
[
|
|
10
|
+
("Hello", "olleH"),
|
|
11
|
+
("Hello World", "dlroW olleH"),
|
|
12
|
+
("12345", "54321"),
|
|
13
|
+
("", ""),
|
|
14
|
+
("a", "a"),
|
|
15
|
+
(" ", " "),
|
|
16
|
+
("kayak", "kayak"),
|
|
17
|
+
(" ab ", " ba "),
|
|
18
|
+
],
|
|
19
|
+
)
|
|
20
|
+
def test_reverse(text, expected):
|
|
21
|
+
assert reverse(text) == expected
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@pytest.mark.parametrize("invalid_input", [None, 123, ["Hello"], {"a": 1}])
|
|
25
|
+
def test_reverse_invalid_input(invalid_input):
|
|
26
|
+
with pytest.raises(TypeError):
|
|
27
|
+
reverse(invalid_input)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
def reverse(text):
|
|
2
|
+
"""Reverses the provided input string.
|
|
3
|
+
|
|
4
|
+
Parameters
|
|
5
|
+
----------
|
|
6
|
+
text : str
|
|
7
|
+
The string to reverse.
|
|
8
|
+
|
|
9
|
+
Returns
|
|
10
|
+
-------
|
|
11
|
+
str
|
|
12
|
+
A new string that is the exact reverse of the input.
|
|
13
|
+
|
|
14
|
+
Raises
|
|
15
|
+
------
|
|
16
|
+
TypeError
|
|
17
|
+
If text is not a string.
|
|
18
|
+
"""
|
|
19
|
+
if not isinstance(text, str):
|
|
20
|
+
raise TypeError("text must be a string")
|
|
21
|
+
return text[::-1]
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: textutils_MB
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: A lightweight Python library for common text-processing operations.
|
|
5
|
+
License: MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2026 Martin-B74
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
Requires-Python: >=3.9
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
33
|
+
Requires-Dist: black>=24.0; extra == "dev"
|
|
34
|
+
Requires-Dist: ruff>=0.3; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# About textutils
|
|
38
|
+
textutils is a lightweight, open-source Python library designed for quick and basic text processing.
|
|
39
|
+
|
|
40
|
+
## Available Functionality
|
|
41
|
+
* **`word_count(text)`**: Counts the total number of words in a given string.
|
|
42
|
+
* **`character_count(text)`**: Counts the total number of characters in a given string.
|
|
43
|
+
* **`reverse(text)`**: Reverses the input string.
|
|
44
|
+
* **`capitalize_words(text)`**: Capitalizes the first letter of every word in the text.
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
Here is a minimal example of how to use the library:
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
import textutils
|
|
51
|
+
|
|
52
|
+
sample_text = "hello world"
|
|
53
|
+
|
|
54
|
+
# Count words
|
|
55
|
+
print(textutils.word_count(sample_text)) # Output: 2
|
|
56
|
+
|
|
57
|
+
# Capitalize words
|
|
58
|
+
print(textutils.capitalize_words(sample_text)) # Output: Hello World
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Contributing
|
|
62
|
+
Contributions are welcome! If you would like to contribute, please follow these steps:
|
|
63
|
+
1. Fork the repository.
|
|
64
|
+
2. Create a new branch for your feature or bugfix.
|
|
65
|
+
3. Commit your changes with clear messages.
|
|
66
|
+
4. Push your branch and open a Pull Request.
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
textutils/__init__.py
|
|
5
|
+
textutils/casing/__init__.py
|
|
6
|
+
textutils/casing/_casing.py
|
|
7
|
+
textutils/counting/__init__.py
|
|
8
|
+
textutils/counting/_counting.py
|
|
9
|
+
textutils/tests/__init__.py
|
|
10
|
+
textutils/tests/test_casing.py
|
|
11
|
+
textutils/tests/test_counting.py
|
|
12
|
+
textutils/tests/test_transform.py
|
|
13
|
+
textutils/transform/__init__.py
|
|
14
|
+
textutils/transform/_transform.py
|
|
15
|
+
textutils_MB.egg-info/PKG-INFO
|
|
16
|
+
textutils_MB.egg-info/SOURCES.txt
|
|
17
|
+
textutils_MB.egg-info/dependency_links.txt
|
|
18
|
+
textutils_MB.egg-info/requires.txt
|
|
19
|
+
textutils_MB.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
textutils
|