Natural Language Processing (NLP).pptx

HelmandAtssar 169 views 31 slides Jul 20, 2024
Slide 1
Slide 1 of 31
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31

About This Presentation

This presentation provides a straightforward and beginner-friendly introduction to Natural Language Processing (NLP). Key topics covered include:

Definition of NLP: Understand what NLP is and its importance in the field of artificial intelligence.
NLP vs. Machine Learning (ML): Learn the difference...


Slide Content

Natural Language Processing(NLP) Prepared by: Helmand “Atssar” Year: 2024

Project analysis slide 2 Introduction to Natural Language Processing (NLP) NLP is a field of AI that enables computers to understand, interpret, and generate human language. It’s used in applications like translation, speech recognition, and chatbots. Siri and Alexa use NLP to understand and respond to user commands.

Project analysis slide 2 NLP as an Intersection of CS, Human Language, and AI Computer Science: Algorithms, data structures, programming. Human Language: Linguistics, syntax, semantics, pragmatics. Artificial Intelligence: Machine learning, deep learning, neural networks.

Project analysis slide 2 Evolution from Bit to NLP 1. Early Computing: Bits and Bytes (1940s-1950s) Basic units of digital data (0s and 1s). 2. Structured Data and Databases (1960s-1970s) Organizing data into structured formats like tables in relational databases. 3. Data Processing and Machine Learning (1980s-1990s) Using algorithms to process data and make predictions or decisions. Examples: Email spam filters, recommendation systems. 4. Natural Language Processing (NLP) (2000s-Present) Enabling computers to understand, interpret, and generate human language. Examples: Chatbots, language translation, sentiment analysis.

Project analysis slide 2 Applications of Natural Language Processing

Project analysis slide 2 What is Machine Learning (ML)? ML is a subset of AI that involves training algorithms to learn from data and make predictions or decisions. It enables systems to improve over time without being explicitly programmed. Example: Email spam filters use ML to identify and block spam emails.

NLP vs. Machine Learning (ML) ML Provides the tools and algorithms for learning from data. Machine Learning Natural Language Processing NLP uses ML techniques to process and analyze language data.

Project analysis slide 2 What’s Model? In computing and programming context, a module refers to a self-contained unit of software that encapsulates a set of related functions or data structures. Advantages: Speed, efficiency, scalability. Example: Training complex models like transformers in a fraction of the time compared to CPUs and GPUs.

Project analysis slide 2 Language Models Language Model: A language model is a type of statistical and probabilistic model that predicts the next word in a sequence of words. It assigns a probability to a sequence of words to help in understanding and generating human language. For example: N-Gram model…

Project analysis slide 2 Formal vs. Natural Languages Formal Languages : Formal Language refers to a precise, structured language with strict rules of grammar, syntax, and vocabulary. For instance: algebrical expressions, python code, Natural Languages : Natural language refers to the language humans use for every day communications, which has evolved naturally over time. For example: English, Pashto, Dari…

Project analysis slide 2 NLP Analysis(1) Lexical and Syntactic Analysis… Lexical Analysis: Breaking down text into words (tokens) and identifying their parts of speech (nouns, verbs, etc.). The sentence "The cat sat on the mat" becomes ["The", "cat", "sat", "on", "the", "mat"]. Syntactic(Parsing) Analysis: Analyzing the structure of a sentence according to grammar rules. Identifying "The cat" as the subject and "sat on the mat" as the predicate in the sentence "The cat sat on the mat".

Project analysis slide 2 NLP Analysis (2) Semantic, Discourse Integration and Pragmatic Analysis Semantic Analysis: Understanding the meaning of words and sentences. Example : Knowing that "cat" is an animal and "sat" is the action of sitting. Discourse Integration: Understanding how sentences relate to each other in a larger context. Example : Sentence 1: “Hamed went to the store.“ Sentence 2: "He bought some milk.“ Knowing "He" refers to “Hamed". Pragmatic Analysis: Interpreting the intended meaning behind words and sentences based on context. Example :"Can you pass the salt?“ Understanding it's a request, not a question about ability.

Project analysis slide 2 NLP Pipeline ( Conclusion)

Project analysis slide 2 NLP Pipeline Steps for Text Process 1. Text Information: Start with raw text data. NLP Analysis: Lexical (word level). 2.Segmentation and Tokenization: Break text into sentences and words. NLP Analysis: Syntactic (Structure of Sentences)

Project analysis slide 2 NLP Pipeline Steps 3. Text Cleaning: Remove unwanted characters, stop words, and punctuation. NLP Analysis: Syntactic (Cleaning sentence structure) 4. Vectorization and Feature Engineering: Convert text into numerical data, which is inherently qualitative into a quantitative numerical format that can be processed by machine learning algorithms. NLP Analysis: lexical/semantic (Meaning and Representation of words.

Project analysis slide 2 NLP Pipeline Steps 5. Text Lemmatization and Stemming: Reduce words to their root forms. NLP Analysis: Lexical (Word Level). 6. Machine Learning Algorithm: Train a model to learn from the text data. NLP Analysis: Semantic/Discourse(meaning and context within text).

Project analysis slide 2 NLP Pipeline Steps 7. Interpretation of Results: Understand and analyze the model’s predications. NLP Analysis: Pragmatic( Pratical use of language in context.)

Project analysis slide 2 Bag-of-Words Model A simple representation of text that counts the frequency of each word, ignoring order and context. It’s a technique used in NLP to represent text data as collection (or bag) of words. Simple and easy to implement. Loses context and word order. Example : "I love my " becomes {"I": 1, "love": 1, "NLP": 1}.

Project analysis slide 2 N-gram Models Models that consider sequences of N words to capture some context. Types: Unigram (1 word), Bigram (2 words), Trigram (3 words). Advantages: Captures some context and word order. Example : "I love NLP" as bigrams: "I love," "love NLP.“ بېلګه: هغه ډوډۍ خوري – هغه ډوډۍ خورئ : حال دا چا دواړه (خورئ) او (خوري) سم دي خو د ګرامر لغت له نظره چې کله ضمیرونو ته وکتل شي، نو بیا اشتباه ده حال دا چې املايي سم دی. مثال: او نان خورد – او نان خوردید : دیده می شود که هر دو لغت (خورد) و (خوردید) از نظر املاء درست است ولی از نظر ګرامر غلط است.

Project analysis slide 2 What’s Neural Network? Neuron : is the basic computational unit inspired by biological neurons in the human brain. Neural Network: is a computational model inspired by the human brain’s structure and functioning. It consists of interconnected nodes, or neurons, organized in layers. Learning : Can learn complex patterns in data. Versatility : Used in image recognition, language processing, and more. A neural network can classify images as cats or dogs.

Project analysis slide 2 What can NLP and NN do together? When NLP and NN are combined, they create powerful models capable of performing a wide range of task related to understanding, generating, and processing human language. Text Classification Sentiment Analysis Named Entity Recognition (NER) Machine Translation Text Generation Question Answering Speech Recognition Chatbots

Project analysis slide 2 Neural Network Models in NLP Neural Network Models : Advanced models using neural networks to understand and generate language. Types: RNN (Recurrent Neural Networks): Capture sequence information and context by looping over data. Transformers: Use attention mechanisms to handle long-range dependencies in data. Example:Transformers are used in models like GPT for language generation.

Project analysis slide 2 Tensor Processing Units (TPUs) Specialized hardware accelerators designed by Google for machine learning tasks. Faster and more efficient than CPUs and GPUs. Example: Used for training large neural network models quickly.

Project analysis slide 2 Why We Need TPUs? TPUs accelerate the training and running of large neural network models. Advantages: Speed, efficiency, scalability. Example: Training complex models like transformers in a fraction of the time compared to CPUs and GPUs.

Project analysis slide 2 Practical Example of NLP using TextBolb library Python Code:

Project analysis slide 2 Environments for NLP Google Colab : Cloud-based platform for writing and executing Python code in Jupyter notebooks. Free access to GPUs/TPUs, easy collaboration. Anaconda : Distribution of Python and R for scientific computing. Simplifies package management and deployment. Kaggle Notebooks : Cloud-based platform for data science competitions and projects.

Project analysis slide 2 Python Frameworks and Libraries for NLP Popular Libraries : NLTK (Natural Language Toolkit) : Tools for text processing and analysis. spaCy : Fast and efficient NLP library for industrial use. TextBlob : Simple API for common NLP tasks. Hugging Face Transformers : Pre-trained models for advanced NLP tasks. Frameworks : TensorFlow : Open-source library for machine learning. PyTorch : Flexible and easy-to-use framework for deep learning.

Project analysis slide 2 NLP for Afghanistan's Development 1. Education : Translation tools and educational chatbots. 2.Government Services : Automated customer service and document analysis. 3.Healthcare : Medical record management and telemedicine support. 4. Agriculture : Market information systems and farmer support chatbots. 5. Media : Fake news detection and content creation tools.

Project analysis slide 2 Refernces to learn NLP

Thank You

Any Question? If you have any question, please ask G o o g l e or ChatGPT !