Skip to content

Text_preprocessing #408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Python/text_preprocessing_nlp/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Script to preprocess text using NLP
Bag of words technique has been used.

## Libraries imported
# nltk

# from nltk.corpus import brown
Brown corpus is used.
humor category of brown corpus has been taken as sample data.

# contractions
Install contractions using following command :
pip install contractions
This library is used for expanding contraction.

# nltk.download("punkt")
Used to download Punkt Sentence Tokenizer. This tokenizer divides a text into a list of sentences, by using an unsupervised algorithm to build a model for abbreviation words, collocations, and words that start sentences.

# from nltk.corpus import stopwords
Stopwords contain all the stopwords. English language stopwords have been removed.

# from nltk.stem import PorterStemmer
PorterStemmer is used for stemming.

# from sklearn.feature_extraction.text import CountVectorizer

## Run script
text_preprocessing.ipynb is jupyter notebook.
you can run each cell by clicking on run.
or
You can use google colab also.


Loading