DEMYSTIFYING NATURAL LANGUAGE PROCESSING (NLP) WITH FLASK WEBAPP USING CUSTOM ML MODEL,API, AND PACKAGES(PART-2): EXPLAINING THE API MODEL AND PYTHON PACKAGES/MODULES USED FOR THE SENTIMENT WEBAPP

oluyede Segun (jr)
4 min readJan 5, 2021

INTRODUCTION

GOAL: This project explains the API used to get sentence sentiment, emotions and category, and the python modules/ packages used to get word sentiment and summarize text in the flask webapp.

FLASK WEBAPP: https://kingofsentiments.herokuapp.com/

OUTLINE:

1. IBM API USED TO GET ,SENTIMENTS , EMOTIONS , AND CATEGORIES OF SENTENCE KEYWORDS AND ENTITIES IN THE FLASK SENTIMENT WEBAPP:

2. EXPLANING THE PYTHON MODULE USED TO GET WORD SENTIMENT IN THE FLASK WEBAPP

3. EXPLANING THE PYTHON MODULE USED TO SUMMARIZE SENTENCES IN THE FLASK WEBAPP.

1. IBM API USED TO GET ,SENTIMENTS , EMOTIONS , AND CATEGORIES OF SENTENCE KEYWORDS AND ENTITIES IN THE FLASK SENTIMENT WEBAPP:

API

API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. Each time you use an app like Facebook, send an instant message, or check the weather on your phone, you’re using an API.

What Is an Example of an API?

When you use an application on your mobile phone, the application connects to the Internet and sends data to a server. The server then retrieves that data, interprets it, performs the necessary actions and sends it back to your phone. The application then interprets that data and presents you with the information you wanted in a readable way. This is what an API is — all of this happens via API.

Example of Popular APIs: Google Maps, AcuuWeather, Youtube , Twitter…

Example of popular APIs used in AI : Alexa Skill Management API, Google Assistant API, IBM Watson Discovery API, SummarizeBot API, CarNet API etc

IBM Natural Language Understanding API was used to analyse the text and get the , Emotions, Category of keywords and entities of the sentence In the Flask webapp.

STEPS

1.1 We first check the documentation of the API to know how to use it in a programming language

link to documentation: https://cloud.ibm.com/apidocs/natural-language-understanding?code=python#sentiment

check the documentation of the API to know how to use it in a programming language

1.2. We import neccesary libraries needed in python to use the IBM API

We import neccesary libraries needed in python to use the IBM API

1.3. Input your IBM IAMAuthenticator credentials and call The IBM Natural Language Understanding API via an ENDPOINT.

API Endpoint and Credentials

NB: you get this credentials from your account after you sign up on ibm

1.4. Use it to get Sentiment , Emotions, Category of keywords and entities from a text sentence and print out result.

getting the sentiment and emotions

2. EXPLANING THE PYTHON MODULES USED TO GET WORD SENTIMENT IN THE FLASK WEBAPP

I installed the Vader library to use to get the sentiment from a word.

Readmore about the vader library here: https://www.geeksforgeeks.org/python-sentiment-analysis-using-vader/

using vader library

3. EXPLANING THE PYTHON MODULE USED TO SUMMARIZE SENTENCES IN THE FLASK WEBAPP.

I installed the gensim library to summarize sentences.

Readmore about the gensim library here: https://pypi.org/project/gensim/

gensim library

4. CONCLUSION

This project explained how to use a web API for NLP .eg. IBM Natural Language Understanding API ,and how to use python modules like vader and gensim libraries for sentiment and summarization as used the webapp

WRITER: OLUYEDE SEGUN . A(jnr)

Explanatory Notebook and dataset:

https://github.com/juniorboycoder/FLASK_SENTIMENT_wEBAPP

Resources used (References):

LINK TO PART-3 (FINAL PART): https://juniorboyboy2.medium.com/demystifying-natural-language-processing-nlp-with-flask-webapp-using-custom-ml-model-api-and-1f7953cfb800

linkedin profile: https://www.linkedin.com/in/oluyede-segun-jr-a-a5550b167/

twitter profile: https://twitter.com/oluyedejun1

TAGS: #NLP #NLTK #Sentiment #MachineLearning #API #IBM #FLASK

--

--

oluyede Segun (jr)
oluyede Segun (jr)

Written by oluyede Segun (jr)

Certified I.T specialist | Computer Network Admin | Cloud | Artificial intelligence ( Machine Learning & Data Science),& webdev. python/JavaScript language

No responses yet