UNIHIVE

Study Hub UNIPORT CSC 494

CSC 494 · Introduction to Artificial Intelligence

Natural language processing

Levels of language analysis, ambiguity, grammars and parsing, statistical and neural methods, and NLP applications.

Our notes

2 min read

What 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

LevelStudiesExample task
Phonologysoundsspeech recognition
Morphologyword structure"unhappiness" = un + happy + ness
Lexicalwords and parts of speechtagging "book" as noun or verb
Syntaxsentence structureparsing
Semanticsmeaningwho did what to whom
Pragmaticsmeaning in context"Can you pass the salt?" is a request
Discourseacross sentenceswhat "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

  1. Rule-based (symbolic): hand-written grammars and dictionaries (early machine translation, ELIZA).
  2. Statistical: probabilities from large text collections (corpora): n-gram language models, hidden Markov models for tagging.
  3. 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

Watch

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.

All CSC 494 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.