Natural Language Processing – NLP

Whenever you dictate something into your iPhone or Android phone device then your dictation is quickly converted to text, because natural language processing algorithm is in action, if so What is Natural Language Processing – NLP? Why should we use it? What are the tools that we can use about NLP? What are some field used examples?.. etc.

Some of you may already have an idea about the answer to these questions, but I want to point out that Natural Language processing applications are developing wildly because artificial intelligence has no limits, it’s just the beginning.

Let’s start the first question; by Wikipedia definition; Natural language processing (NLP) is a subfield of computer science, information engineering, and artificial intelligence concerned with the interactions between computers and human (natural) languages, in particular how to program computers to process and analyze large amounts of natural language data. 1)https://en.wikipedia.org/wiki/Natural_language_processing

Based on this definition, we can say that the focus of Natural Language Processing is teaching machines to understand what is said in the spoken and written in the text, thus texts and sounds are understood and interpreted by machines. 

So why should we use this, when you read or see the NLP application areas, you decide why it is important and should be applied. Some examples of NLP applications areas that you use every day are:

  • Machine translation,
  • Spell check,
  • Voice text messaging,
  • Search autocomplete and smart search,
  • Spam filters,
  • Related keywords on search engines,
  • Customer service automation,
  • Social media monitoring,
  • Virtual assistants like Siri, Google or Alexa.

All of these usage areas are the use of technology in order to improve their product or service, and some are actual software providers that make this technology accessible to businesses. If you are curious about the subject’s history, you can look at the natural language processing at Wikipedia.  

Without further ado in order to understand the rest of the questions about NLP,  let’s first start to look at one of the NLP usages that  I’ve tried which is about a text review to predict if the review is a good one or a bad one.

I used yelp dataset 2)https://www.kaggle.com/kchow23/yelp100000reviews in the sample Kaggle project.  The Yelp dataset is a subset of your reviews for use in personal, educational, and academic purposes. As JSON files, you can use yelp databases to learn NLP.  I conducted the training and testing of the yelp data by using the Scikit-learn libraries. 

When performing exploratory data analysis, I see that there is a correlation between text length and the star rating and in the same way text count. As shown in the graph;

 

 

I attempted to classify Yelp Reviews into 1 star or 5-star categories based on the text content in the reviews.  So just by looking at the length of the text, we make sure that the system has an idea that the comments are one or five stars. Term Frequency, Inverse Document Frequency, and CountVectorizer are the models that I used to preprocess the texts to classify before fitting the Multinomial Naive Bayes classifier algorithm model on the texts.

Confusion matrix and classification report results are amazing. According to the Multinomial Naive Bayes classifier model, average accuracy prediction is 90%. This gives a good insight into the machines as well as us.

You can view all the analyzes and codes of this NLP project from here.3)https://www.kaggle.com/resulcaliskan/nlp-project-004?scriptVersionId=16946608

I used sklearn models, you may use other good NLP tools to train your models. The most important libraries (depends on your work) used for Natural Language Processing are; spaCyNLTK (The mother of all NLP libraries), Gensim, TextBlob, Polyglot, PyNLPl, Stanford CoreNLP. You can check more about tools on Github Site and the broad list can be found here.4)https://github.com/keon/awesome-nlp#libraries

The issues mentioned above are just getting a little exercise, I have mentioned a little bit, it doesn’t mean this is the end of our natural language processing journey because the world of NLP is endless and very deep. We haven’t talked about deep learning models about natural language processing yet, in another article, I will talk about a bag of words, embedded words, semantics and how the model understand sarcasm in the text’s structure.

NLP has started to cover our lives and continues to develop in the AI world. The idea is that there is much more to be done in this area on the whole market. By developing and implementing NLP models in the business world, we can increase our marketing content and gain considerable speed in growth.

Be healthy and happy, see you next article  🙂

 

References   [ + ]

1. https://en.wikipedia.org/wiki/Natural_language_processing
2. https://www.kaggle.com/kchow23/yelp100000reviews
3. https://www.kaggle.com/resulcaliskan/nlp-project-004?scriptVersionId=16946608
4. https://github.com/keon/awesome-nlp#libraries

İlk yorum yapan olun

Bir Cevap Yazın