source: https://pixabay.com/photos/mist-stag-red-deer-ant-antler-4551691/

Natural Language Processing (NLP) for Beginners

Pema Grg
Pema Grg
Sep 6, 2018 · 2 min read

NLP is mainly used for the computers to understand human language and to allow machines to communicate with us 😄

According to the Wiki definition:

Natural-language processing (NLP) is an area of computer science and artificial intelligence concerned with the interactions between computers and human (natural) languages, in particular how to program computers to fruitfully process large amounts of natural language data.

Wondering what are the main NLP applications?

The main applications are listed below:

  • translating the languages,
  • text processing in various languages,
  • automatic summarization,
  • analyzing sentiments,
  • speech recognition,
  • named entity recognition,
  • phrase extraction,
  • tense identification,
  • relationship extraction, etc.

To start with NLP using Python

Learn to clean the data first such as encoding, tokenizing, stemming, removing pos tags, etc. Then try any to build any of the application mentioned above. Before coding think how to start with and how to instruct the system to understand what you want them to do.

Let’s take the easiest one first! Named Entity Recognition, the package is already available in nltk which you can just import. But before you start, how would you solve NER step by step?

  1. take the sentence as input
  2. break the sentence into words
  3. get the part of speech tags
  4. do the Named Entity Recognition

CODE:

import nltk
sentence = “this is just a testing sentence to identify the company and the name John working at Google as a named entity recognition”
words = nltk.word_tokenize(sentence)
pos_tags = nltk.pos_tag(words)
ner = nltk.ne_chunk(pos_tags)
print ner

Result after running the code:

(S
this/DT
is/VBZ
just/RB
a/DT
testing/VBG
sentence/NN
to/TO
identify/VB
the/DT
company/NN
and/CC
the/DT
name/NN
(PERSON John/NNP)
working/VBG
at/IN
(ORGANIZATION Google/NNP)
as/IN
a/DT
named/VBN
entity/NN
recognition/NN)

Well, wasn’t that easy?

To get more hands-on NLP techniques:

  1. NLP using Spacy
  2. NLP using NLTK

Videos to start with for NLP:

  1. NLP Lectures from Stanford

You can also check https://github.com/pemagrg1/natural-language-processing for more NLP applications and tutorials.

Go ahead and try 😄

All the best! 👍

Pema Grg

Written by

Pema Grg

NLP Engineer @EKbana, Nepal | 1yr Exp@Awesummly, Bangalore, India | internship@Meltwater, Bangalore, India | Linkedin: https://www.linkedin.com/in/pemagrg/

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade