CSC 494 · Introduction to Artificial Intelligence
Our notes
2 min readWhat NLP is
Getting computers to understand and generate human language (text and speech). Hard because language is ambiguous, context-dependent and always changing.
Levels of analysis
| Level | Studies | Example task |
|---|---|---|
| Phonology | sounds | speech recognition |
| Morphology | word structure | "unhappiness" = un + happy + ness |
| Lexical | words and parts of speech | tagging "book" as noun or verb |
| Syntax | sentence structure | parsing |
| Semantics | meaning | who did what to whom |
| Pragmatics | meaning in context | "Can you pass the salt?" is a request |
| Discourse | across sentences | what "she" refers to |
Ambiguity
- Lexical: "bank" (river or money).
- Syntactic: "I saw the man with the telescope" (who had the telescope?).
- Referential: "Ada told Ngozi that she passed" (who passed?).
- Pragmatic: sarcasm, indirect requests.
Grammars and parsing
A context-free grammar has rules such as:
S → NP VP; NP → Det N; VP → V NP; Det → "the"; N → "student" | "book"; V → "reads".
Parsing "the student reads the book": S → NP (the student) VP (reads NP (the book)). Parsers build such trees (top-down, bottom-up, chart parsing).
Approaches over time
- Rule-based (symbolic): hand-written grammars and dictionaries (early machine translation, ELIZA).
- Statistical: probabilities from large text collections (corpora): n-gram language models, hidden Markov models for tagging.
- Neural: word embeddings (words as vectors where similar words are close), recurrent networks, and since 2017 transformers, which power large language models used in chat assistants, translation and summarisation.
Worked example: a bigram model
In a small corpus, "the" occurs 100 times and "the exam" 20 times. P(exam | the) = 20/100 = 0.2. The model predicts the next word from counts like these; modern models learn far richer patterns.
Applications
Machine translation, chatbots and assistants, speech-to-text and text-to-speech, spam filtering, sentiment analysis of reviews, question answering, summarisation, grammar checking, information extraction (names, dates).
Nigerian languages
Yoruba, Igbo, Hausa and Nigerian Pidgin have less digital text than English ("low-resource languages"), and tone marks in Yoruba and Igbo matter for meaning. Community and university projects collect datasets and build models for these languages.
Exams usually ask
- Explain the levels of language analysis and kinds of ambiguity.
- Write a simple grammar and parse a sentence.
- Discuss applications and difficulties of NLP.
Common mistake
Thinking a fluent answer from a language model is always true. Fluency is not accuracy; generated text must be checked.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Natural language processing
(opens en.wikipedia.org in a new tab)
Wikipedia, Natural language processing, CC BY-SA 4.0 · licence
-
Large language model
(opens en.wikipedia.org in a new tab)
Wikipedia, Large language model, CC BY-SA 4.0 · licence
Watch
-
Best pick Natural Language Processing: Crash Course AI #7
13 min · ≈ 59 MB · about ₦33
(opens youtube.com in a new tab)
-
Natural Language Processing In 5 Minutes | What Is NLP And How Does It Work? | Simplilearn
5 min · ≈ 23 MB · about ₦13
(opens youtube.com in a new tab)
-
What is NLP (Natural Language Processing)?
10 min · ≈ 45 MB · about ₦25
(opens youtube.com in a new tab)
-
The Difference Between Natural Language Processing and Large Language Models
3 min · ≈ 14 MB · about ₦8
(opens youtube.com in a new tab)
-
What is NLP (Natural Language Processing) and How Does it Work?
3 min · ≈ 14 MB · about ₦8
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.