
Natural Language Processing (NLP) for Beginners
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?
- take the sentence as input
- break the sentence into words
- get the part of speech tags
- 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 nerResult 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:
Videos to start with for NLP:
You can also check https://github.com/pemagrg1/natural-language-processing for more NLP applications and tutorials.
Go ahead and try 😄
All the best! 👍
