How Computers Interpret and Generate Human Language

Liz Waithaka
Women in Technology
5 min readNov 3, 2023

“From deciphering emotions in text to transforming machine translation, Natural Language Processing (NLP) is reshaping our digital world.”

Photo by Xu Haiwei on Unsplash

Introduction:

Recent years have witnessed a remarkable transformation in the ability of computers to comprehend human language. AI models are unlocking the power of being able to analyze the meanings of input text and generating meaningful, expressive output.

Natural Language Processing (NLP), is a field dedicated to empowering machines to interact with human language. NLP can be divided into two overlapping fields: Natural Language Generation(NLG) which focuses on text generation by a machine and Natural Language Understanding(NLU) which focuses on semantic analysis or determining the intended meaning of text.

Why is NLP Important?

NLP is becoming an intergral part in our day to day lives. Language technology is being applied to diverse fields like medicine, retailing, public health. Conversational agents such as Amazon’s Alexa and Apple Siri use NLP to listen to user queries and give answers.

The applications of NLP are extensive, encompassing tasks such as answering questions, classifying text in various ways, and engaging in conversations with users.

Photo by airfocus on Unsplash

Here are tasks that can be solved using NLP:

  1. Sentiment analysis is the process of classifying emotional intent of text. The input to a sentiment classification model is a piece of text and the output is the probability that the sentiment expressed is positive, negative or neutral. The probability is based on either hand generated features, word n-grams, TD-IDF features or using deep learning models to capture sequential long and short term dependencies. Hand generated features are special rules that people come up with to understand feelings. Texts like “happy” or “good” is more likely to be positive. Word n-grams looks at group of words together. For example, “not good” is different from “very good”. TD-IDF Features looks at how important words are in a text. Some words carry more weight in showing feelings. Deep Learning Models are good at understanding the order of words in a text and consider changes in them over time. This can be used in classifying customer reviews on various online platforms as well identifying signs of mental illness in online comments
  2. Toxicity Classification: A branch of sentiment analysis, toxicity classification delves into categorizing hostile intent and specific types of hostility such as threats, insults, obscenities, and hate speech. By analyzing the text, NLP models can predict the probability of each toxicity class. This powerful tool is crucial for moderating and enhancing online conversations by silencing offensive comments, detecting hate speech, and scanning documents for defamation.
  3. Machine Translation automates translation between different languages. The input to such a model is text in a specified source language and the output is the text in a specified target language. Google Translate is a widely recognized example of this mainstream application.
  4. Named Entity recognition aims to extract entities in a piece of text into predefined categories such as personal names, organizations, locations and quantities. Input is text and the output is various named entities along with their start and end positions. This capability proves invaluable in applications like news article summarization and combating disinformation.
  5. Spam detection is a binary classification problem in NLP where the purpose is to classify emails as either spam or not. Spam deterctors take as input the email text along with various other subtexts like title and senders name. They aim to output the probability that the mail is spam. By analyzing the content, email providers like Gmail use these models to improve user experiences, ensuring unsolicited and unwanted emails are directed to designated spam folders.
  6. Grammatical correction are designed to rectify grammatical errors within text. They operate as sequence-to-sequence tasks, where the model is trained on ungrammatical sentences as input and correct sentences as output. These models have found applications not only in academia but also in grading students’ essays.
  7. Topic Modelling is unsupervised text mining is like a smart tool for reading lots of documents. You give it a bunch of documents, and it helps find the main ideas or topics in those documents. It does this without you telling it what to look for; it figures it out on its own. The input is a bunch of documents, like legal papers, articles, or any text. Imagine you have a big pile of them. The output is a list of topics it found in those documents. Think of topics as the main subjects or ideas in the text. It also tells you which words are important for each topic and how much each topic is in each document. Latent Dirichlet Allocation (LDA) is one of the methods this smart tool uses. It sees each document as a mix of different topics and each topic as a mix of important words. It figures out this mix by analyzing the words in the documents. In practical terms, topic modeling proves indispensable in scenarios where professionals, such as lawyers, must sift through vast volumes of legal documents to pinpoint essential information.
  8. Text Generation or Natural Language Generation produces text that is similar to human-written text. Such models can be fine tuned to produce text in different genres and formats including tweets, blogs, computer code. This is useful for autocomplete systems and chatbots.
  9. Information Retrival finds documents that are most relevant to a query. This is a problem every search and recommendation system faces. The goal is not to answer a particular query but to retrieve, from a collection of documents that may be numbered in the millions, a set that is most relevant to the query.
  10. Summarization is the task of shortening text to highlight the most relevant information. Summarization is divided into two method classes: Extractive summarization, which involves selecting and combining essential sentences, or abstractive summarization, where the summary is created by paraphrasing the original text. This is particularly useful for distilling information and key insights from extensive documents.
  11. Question answering deals with answering questions posed by humans in a natural language. Multiple choice question problem is composed of a question and a set of possible answers. The learning task is to pick the correct answer. Open domain: In open-domain question answering, the model provides answers to questions in natural language without any options provided, often by querying a large number of texts.
Photo by Shane Rounce on Unsplash

The significance of NLP in our lives is undeniable, as it continues to revolutionize the way we interact with computers and data. NLP technologies are not only enhancing existing applications but also paving the way for innovative solutions in various domains. As we journey through the world of NLP, we unlock new possibilities and solutions that redefine our relationship with language and data.

--

--

Liz Waithaka
Women in Technology

AI Enthusiast || Machine Learning || Data Scientist || StoryTelling || GitHub: https://github.com/liznjoki