nlp-text-preprocessing 0.0.8__tar.gz → 0.1.0__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.
- nlp_text_preprocessing-0.1.0/MANIFEST.in +3 -0
- {nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/PKG-INFO +18 -3
- nlp_text_preprocessing-0.1.0/Readme.md +231 -0
- {nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/nlp_text_preprocessing/__init__.py +0 -1
- {nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/nlp_text_preprocessing.egg-info/PKG-INFO +18 -3
- {nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/nlp_text_preprocessing.egg-info/SOURCES.txt +2 -0
- nlp_text_preprocessing-0.1.0/requirements.txt +14 -0
- {nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/setup.py +2 -2
- nlp_text_preprocessing-0.0.8/MANIFEST.in +0 -1
- {nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/LICENSE +0 -0
- {nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/nlp_text_preprocessing/all_text_preprocess.py +0 -0
- {nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/nlp_text_preprocessing/data/contractions.json +0 -0
- {nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/nlp_text_preprocessing.egg-info/dependency_links.txt +0 -0
- {nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/nlp_text_preprocessing.egg-info/requires.txt +0 -0
- {nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/nlp_text_preprocessing.egg-info/top_level.txt +0 -0
- {nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nlp_text_preprocessing
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: This is a Text Processing Package For NLP
|
|
5
5
|
Author: Uditya Narayan Tiwari
|
|
6
6
|
Author-email: tiwarimerit@gmail.com
|
|
@@ -35,7 +35,22 @@ Dynamic: requires-python
|
|
|
35
35
|
Dynamic: summary
|
|
36
36
|
|
|
37
37
|
# Text Preprocessing Python Package
|
|
38
|
-
|
|
38
|
+
<p align="center">
|
|
39
|
+
<a href="https://pypi.org/project/nlp-text-preprocessing/">
|
|
40
|
+
<img src="https://img.shields.io/pypi/v/nlp-text-preprocessing" alt="PyPI Version">
|
|
41
|
+
</a>
|
|
42
|
+
<a href="https://pypi.org/project/nlp-text-preprocessing/">
|
|
43
|
+
<img src="https://img.shields.io/pypi/pyversions/nlp-text-preprocessing" alt="Python Version">
|
|
44
|
+
</a>
|
|
45
|
+
<a href="https://pepy.tech/projects/nlp-text-preprocessing">
|
|
46
|
+
<img src="https://static.pepy.tech/badge/nlp-text-preprocessing" alt="Total Downloads">
|
|
47
|
+
</a>
|
|
48
|
+
<a href="https://pepy.tech/projects/nlp-text-preprocessing">
|
|
49
|
+
<img src="https://static.pepy.tech/badge/nlp-text-preprocessing/month" alt="Monthly Downloads">
|
|
50
|
+
</a>
|
|
51
|
+
</p>
|
|
52
|
+
|
|
53
|
+

|
|
39
54
|
|
|
40
55
|
#### Course Link: [Introduction to NLP](https://bit.ly/intro_nlp)
|
|
41
56
|
|
|
@@ -216,7 +231,7 @@ print(ngrams) # Output: [('I', 'love'), ('love', 'NLP')]
|
|
|
216
231
|
|
|
217
232
|
### 4. Full Example: Cleaning Text
|
|
218
233
|
|
|
219
|
-
Here
|
|
234
|
+
Here’s an example of how you might use several functions together to clean text data:
|
|
220
235
|
|
|
221
236
|
```python
|
|
222
237
|
import nlp_text_preprocessing as tp
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Text Preprocessing Python Package
|
|
2
|
+
<p align="center">
|
|
3
|
+
<a href="https://pypi.org/project/nlp-text-preprocessing/">
|
|
4
|
+
<img src="https://img.shields.io/pypi/v/nlp-text-preprocessing" alt="PyPI Version">
|
|
5
|
+
</a>
|
|
6
|
+
<a href="https://pypi.org/project/nlp-text-preprocessing/">
|
|
7
|
+
<img src="https://img.shields.io/pypi/pyversions/nlp-text-preprocessing" alt="Python Version">
|
|
8
|
+
</a>
|
|
9
|
+
<a href="https://pepy.tech/projects/nlp-text-preprocessing">
|
|
10
|
+
<img src="https://static.pepy.tech/badge/nlp-text-preprocessing" alt="Total Downloads">
|
|
11
|
+
</a>
|
|
12
|
+
<a href="https://pepy.tech/projects/nlp-text-preprocessing">
|
|
13
|
+
<img src="https://static.pepy.tech/badge/nlp-text-preprocessing/month" alt="Monthly Downloads">
|
|
14
|
+
</a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
#### Course Link: [Introduction to NLP](https://bit.ly/intro_nlp)
|
|
20
|
+
|
|
21
|
+
This Python package is created by [Uditya Narayan Tiwari](https://youtube.com/kgptalkie). It provides various text preprocessing utilities for natural language processing (NLP) tasks.
|
|
22
|
+
|
|
23
|
+
### Installation from PyPi
|
|
24
|
+
You can install this package using pip as follows:
|
|
25
|
+
```
|
|
26
|
+
pip install nlp_text_preprocessing
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Installation from GitHub
|
|
30
|
+
You can install this package from GitHub as follows:
|
|
31
|
+
```
|
|
32
|
+
pip install git+https://github.com/udityamerit/Text-Processing-Package-For-Natural-Language-Processing.git --upgrade --force-reinstall
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Uninstall the Package
|
|
36
|
+
|
|
37
|
+
To uninstall the package, use the following command:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip uninstall nlp_text_preprocessing
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Requirements
|
|
44
|
+
You need to install these python packages.
|
|
45
|
+
```
|
|
46
|
+
python -m spacy download en_core_web_sm
|
|
47
|
+
spacy
|
|
48
|
+
textblob
|
|
49
|
+
beautifulsoup4
|
|
50
|
+
nltk
|
|
51
|
+
openpyxl
|
|
52
|
+
SpeechRecognition==3.10.4
|
|
53
|
+
pyaudio==0.2.14
|
|
54
|
+
PrettyTable
|
|
55
|
+
scikit-learn
|
|
56
|
+
wordcloud
|
|
57
|
+
lxml
|
|
58
|
+
pandas
|
|
59
|
+
numpy
|
|
60
|
+
matplotlib
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
## How to Use the Package
|
|
65
|
+
|
|
66
|
+
### 1. Basic Text Preprocessing
|
|
67
|
+
|
|
68
|
+
#### Lowercasing Text
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import nlp_text_preprocessing as tp
|
|
72
|
+
|
|
73
|
+
text = "HELLO WORLD!"
|
|
74
|
+
processed_text = tp.to_lower_case(text)
|
|
75
|
+
print(processed_text) # Output: hello world!
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### Expanding Contractions
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
import nlp_text_preprocessing as tp
|
|
82
|
+
|
|
83
|
+
text = "I'm learning NLP."
|
|
84
|
+
processed_text = tp.contraction_to_expansion(text)
|
|
85
|
+
print(processed_text) # Output: I am learning NLP.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Removing Emails
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import nlp_text_preprocessing as tp
|
|
92
|
+
|
|
93
|
+
text = "Contact me at example@example.com"
|
|
94
|
+
processed_text = tp.remove_emails(text)
|
|
95
|
+
print(processed_text) # Output: Contact me at
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### Removing URLs
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
import nlp_text_preprocessing as tp
|
|
102
|
+
|
|
103
|
+
text = "Check out https://example.com"
|
|
104
|
+
processed_text = tp.remove_urls(text)
|
|
105
|
+
print(processed_text) # Output: Check out
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### Removing HTML Tags
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
import nlp_text_preprocessing as tp
|
|
112
|
+
|
|
113
|
+
text = "<p>Hello World!</p>"
|
|
114
|
+
processed_text = tp.remove_html_tags(text)
|
|
115
|
+
print(processed_text) # Output: Hello World!
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### Removing Special Characters
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
import nlp_text_preprocessing as tp
|
|
122
|
+
|
|
123
|
+
text = "Hello @World! #NLP"
|
|
124
|
+
processed_text = tp.remove_special_chars(text)
|
|
125
|
+
print(processed_text) # Output: Hello World NLP
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 2. Advanced Text Processing
|
|
129
|
+
|
|
130
|
+
#### Lemmatization
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
import nlp_text_preprocessing as tp
|
|
134
|
+
|
|
135
|
+
text = "running runs"
|
|
136
|
+
processed_text = tp.lemmatize(text)
|
|
137
|
+
print(processed_text) # Output: run run
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### Sentiment Analysis
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
import nlp_text_preprocessing as tp
|
|
144
|
+
|
|
145
|
+
text = "I love programming!"
|
|
146
|
+
sentiment = tp.sentiment_analysis(text)
|
|
147
|
+
print(sentiment) # Output: Sentiment(polarity=0.5, subjectivity=0.6)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### Detecting and Translating Language
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
import nlp_text_preprocessing as tp
|
|
154
|
+
from googletrans import Translator
|
|
155
|
+
|
|
156
|
+
translator = Translator()
|
|
157
|
+
text = "Bonjour tout le monde"
|
|
158
|
+
lang = tp.detect_language(text, translator)
|
|
159
|
+
translated_text = tp.translate(text, 'en', translator)
|
|
160
|
+
print(f"Language: {lang}, Translated: {translated_text}")
|
|
161
|
+
# Output: Language: fr, Translated: Hello everyone
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 3. Feature Extraction
|
|
165
|
+
|
|
166
|
+
#### Word Count
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
import nlp_text_preprocessing as tp
|
|
170
|
+
|
|
171
|
+
text = "I love NLP."
|
|
172
|
+
count = tp.word_count(text)
|
|
173
|
+
print(count) # Output: 3
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
#### Character Count
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
import nlp_text_preprocessing as tp
|
|
180
|
+
|
|
181
|
+
text = "I love NLP."
|
|
182
|
+
count = tp.char_count(text)
|
|
183
|
+
print(count) # Output: 9
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### N-Grams
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
import nlp_text_preprocessing as tp
|
|
190
|
+
|
|
191
|
+
text = "I love NLP"
|
|
192
|
+
ngrams = tp.n_grams(text, n=2)
|
|
193
|
+
print(ngrams) # Output: [('I', 'love'), ('love', 'NLP')]
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 4. Full Example: Cleaning Text
|
|
197
|
+
|
|
198
|
+
Here’s an example of how you might use several functions together to clean text data:
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
import nlp_text_preprocessing as tp
|
|
202
|
+
|
|
203
|
+
text = "I'm loving this NLP tutorial! Contact me at https://www.linkedin.com/in/uditya-narayan-tiwari-562332289/ Visit https://udityanarayantiwari.netlify.app/"
|
|
204
|
+
cleaned_text = tp.clean_text(text)
|
|
205
|
+
print(cleaned_text)
|
|
206
|
+
# Output: i am loving this nlp tutorial contact me at visit
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### One Short Feature Extraction
|
|
210
|
+
```python
|
|
211
|
+
import nlp_text_preprocessing as tp
|
|
212
|
+
|
|
213
|
+
tp.extract_features("I love NLP")
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Notes
|
|
217
|
+
|
|
218
|
+
- Be cautious when using heavy operations like `lemmatize` and `spelling_correction` on very large datasets, as they can be time-consuming.
|
|
219
|
+
- The package supports custom cleaning and preprocessing pipelines by using these modular functions together.
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
{nlp_text_preprocessing-0.0.8 → nlp_text_preprocessing-0.1.0}/nlp_text_preprocessing/__init__.py
RENAMED
|
@@ -14,7 +14,6 @@ def extract_features(x):
|
|
|
14
14
|
'mentions_count': mentions_count(x),
|
|
15
15
|
'numerics_count': numerics_count(x),
|
|
16
16
|
'upper_case_count': upper_case_count(x),
|
|
17
|
-
'word_cloud': get_wordcloud(x),
|
|
18
17
|
'noun_phrases': get_noun_phrase(x),
|
|
19
18
|
'sentiment_analysis': sentiment_analysis(x)
|
|
20
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nlp_text_preprocessing
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: This is a Text Processing Package For NLP
|
|
5
5
|
Author: Uditya Narayan Tiwari
|
|
6
6
|
Author-email: tiwarimerit@gmail.com
|
|
@@ -35,7 +35,22 @@ Dynamic: requires-python
|
|
|
35
35
|
Dynamic: summary
|
|
36
36
|
|
|
37
37
|
# Text Preprocessing Python Package
|
|
38
|
-
|
|
38
|
+
<p align="center">
|
|
39
|
+
<a href="https://pypi.org/project/nlp-text-preprocessing/">
|
|
40
|
+
<img src="https://img.shields.io/pypi/v/nlp-text-preprocessing" alt="PyPI Version">
|
|
41
|
+
</a>
|
|
42
|
+
<a href="https://pypi.org/project/nlp-text-preprocessing/">
|
|
43
|
+
<img src="https://img.shields.io/pypi/pyversions/nlp-text-preprocessing" alt="Python Version">
|
|
44
|
+
</a>
|
|
45
|
+
<a href="https://pepy.tech/projects/nlp-text-preprocessing">
|
|
46
|
+
<img src="https://static.pepy.tech/badge/nlp-text-preprocessing" alt="Total Downloads">
|
|
47
|
+
</a>
|
|
48
|
+
<a href="https://pepy.tech/projects/nlp-text-preprocessing">
|
|
49
|
+
<img src="https://static.pepy.tech/badge/nlp-text-preprocessing/month" alt="Monthly Downloads">
|
|
50
|
+
</a>
|
|
51
|
+
</p>
|
|
52
|
+
|
|
53
|
+

|
|
39
54
|
|
|
40
55
|
#### Course Link: [Introduction to NLP](https://bit.ly/intro_nlp)
|
|
41
56
|
|
|
@@ -216,7 +231,7 @@ print(ngrams) # Output: [('I', 'love'), ('love', 'NLP')]
|
|
|
216
231
|
|
|
217
232
|
### 4. Full Example: Cleaning Text
|
|
218
233
|
|
|
219
|
-
Here
|
|
234
|
+
Here’s an example of how you might use several functions together to clean text data:
|
|
220
235
|
|
|
221
236
|
```python
|
|
222
237
|
import nlp_text_preprocessing as tp
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import setuptools
|
|
2
2
|
|
|
3
|
-
with open('Readme.md') as fp:
|
|
3
|
+
with open('Readme.md', encoding='utf-8') as fp:
|
|
4
4
|
long_description = fp.read()
|
|
5
5
|
|
|
6
6
|
with open('requirements.txt') as fp:
|
|
@@ -9,7 +9,7 @@ with open('requirements.txt') as fp:
|
|
|
9
9
|
setuptools.setup(
|
|
10
10
|
name='nlp_text_preprocessing',
|
|
11
11
|
include_package_data=True,
|
|
12
|
-
version='0.0
|
|
12
|
+
version='0.1.0',
|
|
13
13
|
author='Uditya Narayan Tiwari',
|
|
14
14
|
author_email='tiwarimerit@gmail.com',
|
|
15
15
|
description='This is a Text Processing Package For NLP',
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
include nlp_text_preprocessing/data/contractions.json
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|