podqast
Machine Learning GuideOCDevelAll episodes

MLG 018 Natural Language Processing 1

57 min
Next episodeMLG 019 Natural Language Processing 21h 05m
Get its new episodes on Latest. No account

Natural language processing (NLP) is machine learning applied to language, from tokenizing and tagging words up to search, translation and chatbots, now led by transformers and LLMs. Also covers stemming vs lemmatization, edit distance, named entity recognition, NLP libraries and where to learn NLP.
Links • Notes and resources at ocdevel.com/mlg/18

What is natural language processing (NLP)? NLP, also called computational linguistics, is machine learning applied to language. It moved from hand-coded linguistic rules to shallow machine learning to deep learning. The state of the art is now the transformer (MLG 033) and the large language models (LLMs) built on it, which replaced the recurrent neural networks and word2vec of MLG 022. Text must become numbers, and word order changes meaning.
Syntax vs semantics Syntax is structure: parts of speech, phrases, word form. Semantics is meaning, which translation and question answering need.
Corpus, token and stop words • Corpus: a collection of documents. The Penn Treebank is a corpus of parsed, part-of-speech-tagged sentences, mostly Wall Street Journal text.

Stemming vs lemmatization Both reduce variants to one form, so "hunting" matches "hunt". Stemming strips affixes by rule; it is fast, and its result need not be a word. Lemmatization returns the dictionary form using vocabulary and part of speech, so "better" becomes "good".
Edit distance The count of single-letter insertions, deletions or substitutions between two words: "cat" and "car" are one apart. Spell checkers propose the closest words and pick the likeliest in context.
Part-of-speech tagging, named entity recognition and parsing • Part-of-speech (POS) tagging labels each word noun, verb, adjective and so on.

NLP applications • Classification: spam and sentiment; sarcasm and negation ("not excellent") defeat word counts.

LLMs now handle translation, summarization, sentiment, question answering and chat. Google's answer box is the featured snippet, now joined by AI Overviews. Speech recognition and OCR are end-to-end neural models, such as OpenAI's Whisper for speech.
NLP libraries in Python • NLTK: tokenizers, stemmers, taggers and corpora, for teaching and preprocessing.

Also about language learning
Every episode about Language learning
More from Machine Learning Guide