Module 04 / 17
Natural Language Processing (NLP)
How AI understands and processes human language.
01 Introduction to NLP
Natural Language Processing (NLP) is a branch of AI that enables computers to understand, interpret, and generate human language. NLP combines computational linguistics with machine learning and deep learning to process text and speech.
02 Text Preprocessing
- Tokenization: Breaking text into words/sentences
- Lowercasing: Converting to lowercase
- Stopword Removal: Removing common words (and, or, the)
- Stemming: Reducing words to root form (running → run)
- Lemmatization: Like stemming but more accurate
- Part-of-Speech Tagging: Labeling word types
- Named Entity Recognition: Identifying entities (names, locations)
03 Text Representation
Bag of Words (BoW):
- Simple representation based on word frequency
- Ignores word order
TF-IDF:
- Term Frequency-Inverse Document Frequency
- Weights based on word importance
Word Embeddings:
- Word2Vec: Skip-gram or CBOW
- GloVe: Global Vectors
- FastText: Subword embeddings
Contextual Embeddings:
- ELMo: Embeddings from Language Models
- BERT: Bidirectional representations
- GPT: Generative Pre-trained Transformer
04 NLP Applications
- Sentiment Analysis: Determining positive/negative sentiment
- Machine Translation: Google Translate, DeepL
- Text Summarization: Summarizing documents
- Question Answering: Answering questions
- Chatbots: Automated customer service
- Speech Recognition: Siri, Google Speech
- Text Generation: ChatGPT, Claude
- Named Entity Recognition: Information extraction
- Text Classification: Document categorization
- Information Extraction: Extracting structured data
05 Large Language Models (LLM)
LLMs are large-scale language models trained on very large text datasets.
Examples:
- GPT-4 (OpenAI): Text generation, coding, analysis
- Claude (Anthropic): Safe AI assistant
- Gemini (Google): Multimodal AI
- LLaMA (Meta): Open-source LLM
- Mistral: Efficient open-source model
Capabilities:
- Few-shot learning
- Chain-of-thought reasoning
- Code generation
- Multilingual understanding
06 NLP Challenges
- Ambiguity: One word has many meanings
- Context: Meaning depends on context
- Sarcasm and Irony: Difficult to detect
- Informal Language: Slang, typos, abbreviations
- Low-Resource Languages: Not all languages have enough data
- Bias: Models can inherit bias from training data
- Hallucination: LLMs can generate false information