In this Python Natural Language Processing article we are going to have Introduction to NLP,
also we are going to talk about the usage of Python Natural Language Processing in real world
application, for NLP purposes we are going to use NLTK, it is a toolkit or library for doing
Natural Language Processing in Python. the library is written in Python.
Also you can read more Python GUI articles in the below links
1: Kivy GUI Development Tutorials
2: TKinter GUI Development Tutorials
4: wxPython GUI Development Tutorials
5: PyQt5 GUI Development Tutorials
What is Natural Language Processing(NLP)
Natural Language Processing (NLP) is concerned with the interaction between natural language
and the computer. also if you see Natural language processing is used everywhere, from search
engines such as Google , to voice interfaces such as Siri.
There are different other usages of NLP like spell checking, spam filtering, related keyword in
search engines, knowledge base support , chatbots., machine translation, speech recognition
and many more.
and it is one of the major components of Artificial Intelligence (AI) and computational linguistics.
Usage of NLP
- Spell correction (MS Word/ any other editor)
- Search engines (Google, Bing, Yahoo)
- Speech engines (Siri, Google Voice)
- Spam classifiers (All e-mail services)
- News feeds (Google, Yahoo!, and so on)
- Machine translation (Google Translate, and so on)
What is NLTK (Natural Language Processing Toolkit)
Language Toolkit (NLTK) is a suite of libraries that has become one of the best tools for
prototyping and building natural language processing systems. NLTK is one of the most popular
and widely used library in the natural language processing (NLP) community. The beauty of
NLTK lies in its simplicity, where most of the complex NLP tasks can be implemented using a
few lines of code. Start off by learning how to tokenize text into component words. Explore
and make use of the WordNet language dictionary.
Installation
You can simply use pip for the installation, also for more information about installation you
can check NLTK Installation guide.
1 |
pip install nltk |
After installation of the NLTK, you need to install data the for the NLTK. NLTK comes with
many corpora, toy grammars, trained models, etc. A complete list is posted at NLTK Data List.
so for the installation we can use NLTK’s data downloader, you can Run the Python interpreter
and type the commands:
1 2 |
>>> import nltk >>> nltk.download() |
A new window should open, showing the NLTK Downloader. Click on the File menu and select Change Download Directory. For central installation, set this to C:\nltk_data (Windows), /usr/local/share/nltk_data (Mac), or /usr/share/nltk_data (Unix). Next, select the packages or collections you want to download.
For more information about installation you can check this link NLTK Data Installation.
Test that the data has been installed as follows. (This assumes you downloaded the Brown Corpus):
1 2 3 4 |
from nltk.corpus import brown print(brown.words()) |
This will be the result
1 |
['The', 'Fulton', 'County', 'Grand', 'Jury', 'said', ...] |
Subscribe and Get Free Video Courses & Articles in your Email
Comments are closed.