blitztext 0.2.1__cp315-cp315-win_amd64.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.
blitztext/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ from .blitztext import *
2
+
3
+ __doc__ = blitztext.__doc__
4
+ if hasattr(blitztext, "__all__"):
5
+ __all__ = blitztext.__all__
blitztext/__init__.pyi ADDED
@@ -0,0 +1,159 @@
1
+ from typing import Dict, List, Optional, Tuple
2
+
3
+ class KeywordMatch:
4
+ """
5
+ Represents a matched keyword in the text.
6
+
7
+ Attributes:
8
+ keyword (str): The matched keyword or its clean name.
9
+ similarity (float): The similarity score of the match (1.0 for exact matches).
10
+ start (int): UTF-8 byte offset where the match starts in the text.
11
+ end (int): UTF-8 byte offset where the match ends in the text.
12
+ """
13
+ keyword: str
14
+ similarity: float
15
+ start: int
16
+ end: int
17
+
18
+ def __repr__(self) -> str:
19
+ """
20
+ Returns a string representation of the KeywordMatch object.
21
+ """
22
+ ...
23
+
24
+ class KeywordProcessor:
25
+ """
26
+ A processor for efficient keyword matching and replacement in text.
27
+
28
+ Based on AhoCorasick for fast keyword operations,
29
+ including fuzzy matching capabilities.
30
+ """
31
+
32
+ def __init__(self, case_sensitive: Optional[bool] = None, allow_overlaps: Optional[bool] = None) -> None:
33
+ """
34
+ Initialize a new KeywordProcessor.
35
+
36
+ Args:
37
+ case_sensitive: If True, matching will be case-sensitive. Default is False.
38
+ allow_overlaps: If True, allows overlapping matches. Default is True.
39
+ """
40
+ ...
41
+
42
+ def add_keyword(self, keyword: str, clean_name: Optional[str] = None) -> None:
43
+ """
44
+ Add a keyword to the processor.
45
+
46
+ Args:
47
+ keyword: The keyword to add.
48
+ clean_name: An optional 'clean' version of the keyword to return when found.
49
+ """
50
+ ...
51
+
52
+ def remove_keyword(self, keyword: str) -> bool:
53
+ """
54
+ Remove a keyword from the processor.
55
+
56
+ Args:
57
+ keyword: The keyword to remove.
58
+
59
+ Returns:
60
+ True if the keyword was found and removed, False otherwise.
61
+ """
62
+ ...
63
+
64
+ def extract_keywords(self, text: str, threshold: Optional[float] = None) -> List[KeywordMatch]:
65
+ """
66
+ Extract keywords from the given text.
67
+
68
+ Args:
69
+ text: The text to search for keywords.
70
+ threshold: Threshold for fuzzy matching (0.0 to 1.0). Default is 1.0 (exact matches only).
71
+
72
+ Returns:
73
+ A list of KeywordMatch objects representing the found keywords.
74
+ """
75
+ ...
76
+
77
+ def parallel_extract_keywords_from_texts(self, texts: List[str], threshold: Optional[float] = None) -> List[List[KeywordMatch]]:
78
+ """
79
+ Extract keywords from multiple texts in parallel.
80
+
81
+ Args:
82
+ texts: A list of texts to search for keywords.
83
+ threshold: Threshold for fuzzy matching (0.0 to 1.0). Default is 1.0 (exact matches only).
84
+
85
+ Returns:
86
+ A list of lists of KeywordMatch objects, one list per input text.
87
+ """
88
+ ...
89
+
90
+ def replace_keywords(self, text: str, threshold: Optional[float] = None) -> str:
91
+ """
92
+ Replace keywords in the given text with their clean names.
93
+
94
+ Args:
95
+ text: The text in which to replace keywords.
96
+ threshold: Threshold for fuzzy matching (0.0 to 1.0). Default is 1.0 (exact matches only).
97
+
98
+ Returns:
99
+ The text with keywords replaced by their clean names.
100
+ """
101
+ ...
102
+
103
+ def parallel_replace_keywords_from_texts(self, texts: List[str], threshold: Optional[float] = None) -> List[str]:
104
+ """
105
+ Replace keywords in multiple texts in parallel.
106
+
107
+ Args:
108
+ texts: A list of texts in which to replace keywords.
109
+ threshold: Threshold for fuzzy matching (0.0 to 1.0). Default is 1.0 (exact matches only).
110
+
111
+ Returns:
112
+ A list of strings with keywords replaced by their clean names.
113
+ """
114
+ ...
115
+
116
+ def get_all_keywords(self) -> Dict[str, str]:
117
+ """
118
+ Get all keywords and their clean names.
119
+
120
+ Returns:
121
+ A dictionary where keys are keywords and values are their clean names.
122
+ """
123
+ ...
124
+
125
+ def set_non_word_boundaries(self, boundaries: List[str]) -> None:
126
+ """
127
+ Set the characters that are considered part of a word.
128
+
129
+ Args:
130
+ boundaries: A list of characters to be set as non-word boundaries.
131
+ """
132
+ ...
133
+
134
+ def add_non_word_boundary(self, boundary: str) -> None:
135
+ """
136
+ Add a single character as a non-word boundary.
137
+
138
+ Args:
139
+ boundary: The character to be added as a non-word boundary.
140
+ """
141
+ ...
142
+
143
+ def __len__(self) -> int:
144
+ """
145
+ Get the number of keywords in the processor.
146
+
147
+ Returns:
148
+ The number of keywords.
149
+ """
150
+ ...
151
+
152
+ def __repr__(self) -> str:
153
+ """
154
+ Get a string representation of the KeywordProcessor.
155
+
156
+ Returns:
157
+ A string representation including the number of keywords.
158
+ """
159
+ ...
Binary file
blitztext/py.typed ADDED
File without changes
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.4
2
+ Name: blitztext
3
+ Version: 0.2.1
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.8
@@ -0,0 +1,9 @@
1
+ blitztext/__init__.py,sha256=pOLO1hwZxoTihScRSVIFZYggcF89bbSUaeAETVbzv5E,119
2
+ blitztext/__init__.pyi,sha256=YLI13c7VeU94xebRbGJC17xXJV5_UEXjUUlBnf2OKm8,4988
3
+ blitztext/blitztext.cp315-win_amd64.pyd,sha256=-jhmzcaO3glTHG3alNMziGVgelRFgAP9rTvIKNV70ww,490496
4
+ blitztext/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ blitztext-0.2.1.dist-info/METADATA,sha256=Muoj2NSE6KEwN6JNkwLyVQ0Phofe_SiF5g_MYqNFZHY,280
6
+ blitztext-0.2.1.dist-info/WHEEL,sha256=1_h6kx0k2_JFDbRzyfVOsGEcPlSNf1uBTnmW3MNufiU,97
7
+ blitztext-0.2.1.dist-info/licenses/LICENSE,sha256=M96WJMlfMKb2MSk9-Wnb432DqTdlu9qQiuLS0vutwEY,1119
8
+ blitztext-0.2.1.dist-info/sboms/blitztext.cyclonedx.json,sha256=bJ3LdsMBDx4-NBpcndemf8m0lpmKd01ff_8qw-geGsk,44467
9
+ blitztext-0.2.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.15.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp315-cp315-win_amd64
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Praise Oketola (oketola.praise@gmail.com)
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.