Loading, please wait...



SENTENCE ANALYSIS - NATURAL LANGUAGE PROCESSING - THE PROGRAMMING WAY

In this article, we will learn to analyze a sentence using Natural Language Processing on Python Platform
In this article, we will concentrate on the project of Sentence Analysis to eliminate punctuation and stopwords from Sentence

Things to remember:

What are Punctuations?

  • Punctuations are the marks, such as full stop, comma, and brackets, used in writing to separate sentences and their elements and to clarify the meaning and to bring effect to the sentence.

What are Stopwords?

  • In Computer Science the stopwords are words as such as the, is, at, which, and on which are usually ignored by the search engines to efficient the search engine algorithm.

 

Software required:

  • Python 3.5+
  • Jupyter Notebook x64 version
  • Proper Internet Connection
  • Anaconda 

Theory required:

Let's start:

  • we need to import the required library in python to make sure the requirement for our program is made upon the requirement
    import string
    from nltk.corpus import stopwords​
  • for an example, we need to view English first 15 corpus
    stopwords.words('english')[0:15]​
  • Now we will create a sentence to apply our logic
    example_sentence = 'Welcome to TutorialsLink ! you are awesome'​
  • Next, we will remove the punctuations and print them
    delete_punctuation = [char for char in example_sentence if char not in string.punctuation]
    delete_punctuation​
  • Now, we will remove punctuations and print them in a single sentence
    delete_punctuation = ''.join(delete_punctuation)
    delete_punctuation​
  • Next, we will split the words in the sentence
    delete_punctuation.split()​
  • Then, we will eliminate the stopwords
    final_clean = [word for word in delete_punctuation.split() if word.lower() not in stopwords.words('english')]​
  • And finally, we will show our output
    final_clean​

The Screenshot

 

 
TakeAway
 
Natural Language Processing or NLP popularly is enhancing Artificial Intelligence by juicing out the data and grasping out the information required to serve both industry and customer, reducing the data that is not required which eventually increases the quality and efficiency of data processing. So keep learning and keep growing.