Giter VIP home page Giter VIP logo

text-pre-processing-in-python's Introduction

Created Date: 31 Oct 2018

Text-Pre-Processing-Text-in-Python

So are you planning to do research in the text field but not sure about how to start? 
Well, why not start with pre-processing of text as it is very important while doing research in text field and its easy! while cleaning the text helps you get quality output by removing all irrelevant text and getting the forms of the words etc. 
In this article, we will be covering:

  1. Converting text to lowercase
  2. Contraction
  3. Sentence tokenize
  4. Word tokenize
  5. Spell Check
  6. Lemmatize
  7. Stemming
  8. Remove Tags
  9. Remove numbers
  10. Remove punctuation
  11. Remove stopwords


Let's START! 
Pre-requisites:
install Python
install NLTK
pip install autocorrect


Done with the installations? okay! let's start coding! 

Convert text to lower case:

Converting text to lower case as in, converting "Hello" to "hello" or "HELLO" to "hello".

Contraction

Contraction helps to expand the word form like "ain't": "am not". Contractions file has been created in my github which we will be importing to use it.

sentence tokenize

Tokenize sentences if the there are more than 1 sentence i.e breaking the sentences to list of sentence.

word tokenize

Tokenize words to get the tokens of the text i.e breaking the sentences into list of words.

Spell Check

correct the incorrect spelled words like "wrld" to "world"

Lemmatize

lemmatize the text so as to get its root form eg: functions,funtionality as function

Stemming

stemming is the process of reducing inflected (or sometimes derived) words to their word stem, base or root form

Remove Tags

Removing html tags from the text like "" using regex.

Remove Numbers

Removing numbers from the text like "1,2,3,4,5…" We usually remove numbers when we do text clustering or getting keyphrases as we numbers doesn't give much importance to get the main words. To remove numbers, you can use: .isnumeric() else .isdigit()

Remove punctuation

Removing punctuation from the text like ".?!" and also the symbols like "@#$" .

Stop words removal

Remove irrelevant words using nltk stop words like "is,the,a" etc from the sentences as they don't carry any information.

PS:

You can test all those individually from the folder "individual_python_files"
else run main.py directly
Preprocess.py is where the Preprocess class has been created for all the invidual task.

text-pre-processing-in-python's People

Contributors

pemagrg1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.