Introduction to
Natural Language Processing
Jian Tao
jtao@tamu.edu
09/19/2023
Part I. Basics of Natural Language Processing
Credit: practicalnlp.ai
Introduction
A Brief History of NLP
Applications of NLP
NLP is commonly used in:
Context
Meaning
Syntax
Phrases & Sentences
Morphemes & Lexemes
Phonemes
Speech & Sounds
Words
Summarization
Topic Modeling Sentiment Analysis
Parsing
Entity Extraction
Relation Extraction
Tokenization
Word Embeddings
POS Tagging
Speech to Text
Speaker Identification
Text to Speech
Blocks of Language
Applications
Applications of NLP - Continue
Natural Language Processing (NLP) has a broad range of applications across various domains and industries.
Applications of NLP - Continue
Some more applications
NLP - Classical Approach
Tokenization
POS Tagging
Stopword Removal
…
Inference
Modeling
Feature
Extraction
Sentiment
Classification
Entity Extraction
…….
Translation
Topic Modeling
Pre-processing
Output
Modeling
NLP - Deep Learning-Based Approach
Sentiment
Classification
Entity Extraction
…….
Translation
Topic Modeling
Pre-Processing
Dense Embeddings
Hidden Layers
Output Units
Output
Documents
Pipeline of NLP Applications
Data Acquisition
Text Cleaning
Pre-Processing
Feature
Engineering
Monitoring &
Model Updating
Deployment
Evaluation
Modeling
Improving
the model
Pre-processing for NLP
Text
Sentence
Sentences
Sentence
Tokenization
Lowercasing
Removal of
Punctuation
Stemming
Lemmatization
Basic
Pre-processing - an Example
Credit: practicalnlp.ai
* POS: part-of-speech
Text Processing - Bag of Words
Bag of Words
Bag of N-Grams
Text Processing - TF-IDF
Term Frequency–Inverse Document Frequency (TF-IDF)
Text Classification - Common Classifiers
A probabilistic classifier that uses Bayes’ theorem to classify texts based on the evidence seen in training data.
A machine learning method to train a linear separator between classes in the training data with the aim of maximizing the probability of the data.
A support vector machine (SVM) is a discriminative classifier like logistic regression. It looks for an optimal hyperplane in a higher dimensional space, to separate the classes by a maximum possible margin.
A family of machine learning algorithms utilizing different types of multilayered neural networks, such as, CNN, RNN, LSTM, etc.
Text Classification - a Typical Workflow
Large Language Models
Image credit: Hugging Face
Large language models (LLMs) are a category of machine learning models specifically designed to handle, generate, and understand text data at a vast scale.
Large Language Models - Landscape
Lllama 2 by Meta
Lllama 2 by Meta
Supervised Fine-tuning for LLMs
Internet Scale Dataset
Base LLM
Supervised Learning
Fine-tuned LLM
Specific Knowledge Base
Documents on Internet
Meta Llama 2
Code-specific Datasets
Model that can generate code in popular programming languages like Python, C++, Java, PHP, Typescript (Javascript), C#, Bash and more.
From Llama to Code Llama
Supervised Fine-tuning for LLMs
Internet Scale Dataset
Base LLM
Supervised Learning
Fine-tuned LLM
Specific Knowledge Base
Code on Github
Meta Code Llama
My New Language X
Model that can generate code in X
From Code Llama to Customized Llama
Using LLMs
Part II. Hands-on Session:
Basic NLP with NLTK
Appendix
LICENSE AND DISCLAIMER
MIT License
Copyright (c) 2022 Jian Tao
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
GitHub Repository for the Webinars
Jupyter Notebook and JupyterLab
Jupyter Notebook
JupyterLab
Google Colaboratory
Google Colaboratory
Search GitHub user: jtao/dswebinar