What is NLP?
NLP is a field of linguistics and machine learning focused on understanding everything related to human language. The aim of NLP tasks is not only to understand single words individually, but to be able to understand the context of those words. 🔗
Tasks
- Spell Check
- Predictive Text/Typing
- Translation
- Dialog Systems/Speech Recognition
- Chapter 14, Speech and Language Processing, Daniel Jurafsky & James H. Martin
- Sentiment/Opinion Analysis
- Text Classification
- Survey Analysis
- Question Answering
- Natural Language Instruction / Digital Personal Assistant
- Information Extraction, Summarization & Language Compression
- Handwriting Recognition
Why is NLP Hard?
- Semantic ambiguity: a word can have multiple meanings
- Meaning ambiguity: phrases can have multiple meanings (“Call me an ambulance”)
- Prepositional phrase attachment ambiguity: “San Jose cops kill man with knife”
- Pronoun reference ambiguity: Dr. Macklin often brings his dog to visit the patients. He just loves to give kisses.
- Lingo: LOL (laugh out loud), Idk (I don’t know), brb (be right back) etc.
- Meanings shift across time: same word can have different interpretation over the years
- Scale: the Web contains billions of words
A spectrum of NLP problems
- Part-of-Speech Tagging: (tag prepositions, pronouns, adjectives, nouns etc.)
- Syntactic (Constituency) Tagging: (NP: Noun Phrase (the hungry cat), VP: Verb Phrase (chased the mouse), PP: Prepositional Phrase (in the house), S: Sentence)
- Syntactic Categories (Lexical and phrasal categories together are called syntactic categories)
- Dependency Parsing: Dependencies are asymmetrical relations between two lexical items (words)
Unlike constituency parsing, dependency parsing does not utilize the phrasal constituents or sub-phrases.
- Semantic Analysis
- Co-reference Resolution
- Discourse Analysis
- Learning Representations
HuggingFace Pipelines/Tasks
Text pipelines
text-generation: Generate text from a prompttext-classification: Classify text into predefined categoriessummarization: Create a shorter version of a text while preserving key informationtranslation: Translate text from one language to anotherzero-shot-classification: Classify text without prior training on specific labelsfeature-extraction: Extract vector representations of text
Image pipelines
image-to-text: Generate text descriptions of imagesimage-classification: Identify objects in an imageobject-detection: Locate and identify objects in images
Audio pipelines
automatic-speech-recognition: Convert speech to textaudio-classification: Classify audio into categoriestext-to-speech: Convert text to spoken audio
Multimodal pipelines
image-text-to-text: Respond to an image based on a text prompt