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 10 pages
Exam (elaborations)

COS4861 Assignment 2 2025 (NLP) Due 2025

Document preview thumbnail
Preview 2 out of 10 pages

This document provides a comprehensive response to the COS4861/0/2025 Assignment 2 on Natural Language Processing (NLP), addressing theoretical and practical dimensions of automata and data preprocessing. The theoretical section rigorously defines Deterministic Finite State Automata (DFSA) and Non-Deterministic Finite State Automata (NDFSA), detailing their components, operations, and differences through formal notation and illustrative examples. A proof of equivalence between NDFSA and DFSA is presented via the subset construction algorithm, accompanied by a step-by-step conversion example. The significance of these automata in NLP tasks, such as tokenization and syntax parsing, is critically analyzed with practical applications. The practical section implements an NLP preprocessing pipeline, applying tokenization, stopwords removal, stemming, and lemmatization to a sample text dataset using Python’s NLTK library. An enhanced code version incorporates POS-tagged lemmatization and robust error handling. Each preprocessing step is explained, with critical insights into its impact on data quality and model performance. Supported by scholarly references, this work bridges theoretical foundations and practical applications, demonstrating proficiency in automata theory and NLP preprocessing for advanced computational tasks.

Content preview

COS4861

Assignment 2

Natural Language Processing

Due 2025

, Question 1: Theory of Automata
1.1 Definition and Explanation of Deterministic Finite State Automata (DFSA)
A Deterministic Finite State Automaton (DFSA) is a mathematical model of computation de-
signed to recognize regular languages. It processes an input string and either accepts or rejects it based
on whether the string belongs to the defined language.

Key Components of a DFSA
A DFSA is formally defined as a 5-tuple (Q, Σ, δ, q0 , F ), where:

• Q: A finite set of states.
• Σ: A finite set of input symbols, known as the alphabet.
• δ: A transition function, δ : Q × Σ → Q, which maps a current state and input symbol to a unique
next state.

• q0 ∈ Q: The initial state.
• F ⊆ Q: A set of accepting (final) states.

Operation of a DFSA
The DFSA starts in the initial state q0 . For each input symbol, the transition function δ determines the
next state. After processing the entire string, if the final state is in F , the string is accepted; otherwise,
it is rejected.

Example
Consider a DFSA that accepts strings over Σ = {0, 1} with an even number of 1s:
• Q = {q0 , q1 }, where q0 represents an even number of 1s and q1 an odd number.
• Σ = {0, 1}.

• δ:
– δ(q0 , 0) = q0 , δ(q0 , 1) = q1 .
– δ(q1 , 0) = q1 , δ(q1 , 1) = q0 .
• q0 : Initial state (even number of 1s).

• F = {q0 }: Accepting state for even number of 1s.
For the input string “101”:
1. Start at q0 .
2. Read 1: δ(q0 , 1) = q1 .

3. Read 0: δ(q1 , 0) = q1 .
4. Read 1: δ(q1 , 1) = q0 .
5. End in q0 ∈ F , so the string is accepted.

This DFSA is deterministic, as each state-input pair has exactly one next state, ensuring predictable
behavior [1].




1

Connected book
 image
Steven Bird, Ewan Klein Natural Language Processing with Python
Publisher: juni 2009 ISBN: 9780596516499 Edition: 1

Document information

Uploaded on
July 13, 2025
Number of pages
10
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$2.91

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
689
Followers
188
Items
1561
Last sold
3 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

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

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card 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