
MLG 018 Natural Language Processing 1
Machine Learning Guide
Chatbots and Image Captioning
There is a huge uptick in chatbots in the world to day. Companies are going chatbot wild. There's this push towards a concept called u i free, or no u i,. Or no u x, any number of things. What they're trying to say is companies ar trying to build a chat bot and so that you're interacting with the chat bot either verbally or on your keyboard. So chatbots are very fun to work with.
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
- Join the free MLG group: listen to my other AI shows, ask me questions, and talk with other listeners
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 semanticsSyntax 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.
- Token: a word, punctuation mark or emoticon. Tokenization splits a document into tokens.
- Stop words: frequent words like "the" and "of", dropped for keyword search and kept when grammar matters.
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 distanceThe 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.
- Named entity recognition (NER) pulls out what a task needs. "Add lunch with John to my calendar on May 15th" yields what = lunch, who = John, when = May 15th; intent extraction adds the action.
- Relationship extraction turns "Steve Jobs co-founded Apple" into cofounded(Steve Jobs, Apple).
- Syntax tree parsing nests constituents: "the boy with blonde hair" (noun phrase) + "jumped into the water" (verb phrase), down to POS tags.
- Classification: spam and sentiment; sarcasm and negation ("not excellent") defeat word counts.
- Topic modeling: latent Dirichlet allocation (LDA) tags a document with several topics.
- Search and document similarity: TF-IDF. Kaggle's Quora Question Pairs competition asked for duplicate questions.
- Natural language understanding: question answering, textual entailment, machine translation.
- Natural language generation: chatbots, image captioning, summarization.
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.
- spaCy: production pipelines (tokens, tags, NER, dependency parses, lemmas), with transformer pipelines since v3.
- Hugging Face Transformers: pretrained transformer models.
- Stanza: Stanford's neural Python pipeline, which also wraps the Java CoreNLP.
- Apache OpenNLP: a maintained Java toolkit.
- Speech and Language Processing by Daniel Jurafsky and James H. Martin; the third-edition draft is free online.
- The NLTK book, Natural Language Processing with Python, by Steven Bird, Ewan Klein and Edward Loper: free, shorter and hands-on.
- Stanford CS224N, whose YouTube lectures work as audio (convert video to mp3).
Next: MLG 019, on the classical NLP algorithms.


