Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4,6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 14 pages
Exam (elaborations)

COS4861 Assignment 3 2026 Natural Language Processing Year Module 2026

Document preview thumbnail
Preview 2 out of 14 pages

A clear, well-structured assignment with accurate answers and explanations to help you understand the material and complete your work with confidence. Work with us and give yourself a better chance of success.

Content preview

UNIVERSITY OF SOUTH AFRICA (UNISA)
College of Science, Engineering and Technology — School of Computing







Natural Language Processing
Assignment 3 — 2026







Module Code: COS4861

Module Name: Natural Language Processing

Assignment No.: Assignment 3

Due Date: Year Module 2026

Semester: 2026

Department: Computer Science




Submitted in partial fulfilment of the requirements for Natural Language Processing (COS4861)
at the University of South Africa.

, UNISA | COS4861 Assignment 3 — 2026



Question 1: Non-Deterministic Recognition of Regular Languages

Recognition in a non-deterministic finite-state automaton (NFSA) is not a single deterministic
walk through the transition graph but a search problem: at every state offering more than
one outgoing transition on the current symbol, or an ε-move, the machine must keep track
of alternatives it has not yet tried, because a wrong choice can dead-end before the tape is
consumed: a non-deterministic FSA is guaranteed to have at least one accepting path for
any string that belongs to its language, but not every path taken through the machine on that
string will reach an accept state (Jurafsky and Martin, 2007:39–40). The ND-RECOGNIZE
algorithm in Jurafsky and Martin (2007) solves this by maintaining an agenda of search-
states and systematically expanding it until the tape is exhausted at an accepting state or the
agenda is empty. The order in which the agenda is popped, last-in-first-out or first-in-first-out,
is what separates a depth-first search from a breadth-first search over the same graph, and
the two strategies explore an identical search space in a different order, at a different total
cost.


1.1 Automaton Representation


The automaton in Figure 2.21 of Jurafsky and Martin recognises the sheep-language pattern
baa+!, meaning the literal character b, followed by exactly one a, followed by one or more
further a characters (via a self-loop), followed by the literal !. This is represented below as a
Python class rather than a bare nested dictionary, because a class lets the transition table,
the alphabet, the start state and the accepting states travel together as one coherent object
that both search strategies can share without duplication.

Non-determinism is captured by mapping every (state, symbol) pair to a list of destination
states rather than a single state, and ε-moves are stored under the reserved symbol None,
which the search engine treats specially: it can be taken without consuming a character from
the tape.
1 from collections import deque , namedtuple
2

3 # A single search - state on the agenda : the automaton node paired with
4 # the tape pointer at the moment that node was reached .
5 SearchState = namedtuple ( " SearchState " , [ " node " , " pointer " ])
6

7 EPSILON = None # reserved symbol for epsilon - moves
8




Page 1 of 13

Connected book
 image
Publisher: 2013 ISBN: 9789380578774 Edition: Unknown

Document information

Uploaded on
August 25, 2026
Number of pages
14
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
R80,69

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
LectureLab
3,6
(86)
Sold
683
Followers
188
Items
1553
Last sold
1 week ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions