10 Natural Language Processing

Artificial Intelligence · Unit 10

Natural Language Processing

Exam-focused notes for Natural Language Processing (Artificial Intelligence, BIT252): what the TU syllabus asks and how it has actually been tested, with 4 solved past questions from this unit.

Natural Language Processing in short

Natural language processing (NLP) lets computers understand and produce human language. It is hard because human language is rich, flexible, and often unclear. This chapter covers the stages of NLP and the main difficulties.

Natural Language Processing: notes

NLP steps and pipeline

The classic NLP pipeline has these stages, from words to meaning:

StageTaskExample output
Lexical analysisSplit text into words (tokens) and find their parts of speech"The cat sat" gives The (det), cat (noun), sat (verb)
Syntactic analysis (parsing)Check grammar and build a parse treeSentence = noun phrase + verb phrase
Semantic analysisFind the literal meaning of the sentencesat(cat)
Discourse integrationLink the sentence to earlier sentences"It" refers to the cat
Pragmatic analysisFind the intended meaning using contextA request, not just a question

Lexical analysis also includes removing stop words, stemming (cutting "playing" to "play"), and finding the root form.

Syntactic analysis uses a grammar. A small example:

S  -> NP VP
NP -> Det N
VP -> V NP

The sentence "The boy ate an apple" parses as S, with NP "The boy" and VP "ate an apple" containing the NP "an apple". A sentence like "Ate boy the apple" is rejected.

Semantic analysis gives a meaning form, for example $ate(boy, apple)$. It checks that the meaning is sensible. "Colourless green ideas sleep" is grammatical but has no sensible meaning.

Ambiguities in natural language

Ambiguity means that a word or sentence has more than one possible meaning. Each NLP step has its own kind:

  • Lexical ambiguity: a word has several meanings or parts of speech. "Bank" can be a river bank or a money bank. "Book" can be a noun or a verb.
  • Syntactic (structural) ambiguity: a sentence has more than one parse tree. "I saw the man with a telescope" can mean I used the telescope, or the man had it.
  • Semantic ambiguity: the sentence structure is clear but the meaning is not. "The chicken is ready to eat" can mean the chicken will eat, or someone will eat it.
  • Anaphoric (referential) ambiguity: a pronoun can refer to several things. "Ram told Hari that he won" does not say who won.
  • Pragmatic ambiguity: the intended meaning depends on context. "Can you pass the salt?" is a request, not a question about ability.

Ambiguity is solved with context, grammar rules, word-sense knowledge, and statistical models trained on large text.

What this unit covers

  • NLP steps and pipeline
  • Ambiguities in natural language
  • Natural language understanding
  • Natural language generation
  • Discourse analysis
  • Pragmatic analysis

Discourse analysis

2082 · 5 marks

Discuss the discourse and pragmatic analytics in natural language processing. [5]

Show solved answer

Discourse and Pragmatic Analytics in Natural Language Processing


1. Discourse Analytics

Discourse refers to the analysis of language beyond the sentence level. It deals with how sentences are connected and structured to form coherent text or conversation.

Key Components of Discourse Analytics:

a) Discourse Structure

  • Analyzes how sentences and paragraphs are organized to convey meaning.
  • Identifies rhetorical relations between text segments (e.g., cause-effect, contrast, elaboration).

b) Coreference Resolution

  • Determines when different expressions in a text refer to the same entity.
  • Example: "Ram went to the store. He bought milk." -- "He" refers to Ram.

c) Discourse Coherence

  • Ensures that a text is logically and semantically connected.
  • Models like Centering Theory track how entities are introduced and maintained across sentences.

d) Anaphora Resolution

  • Identifies what a pronoun or noun phrase refers to in earlier text.
  • Example: Resolving "it", "they", "this" to their antecedents.

e) Topic Segmentation

  • Divides a document into segments based on topic shifts.
  • Used in summarization, information retrieval, and dialogue systems.

2. Pragmatic Analytics

Pragmatics is the study of how context influences the interpretation of meaning. It goes beyond literal meaning to understand the intended meaning of an utterance.

Key Components of Pragmatic Analytics:

a) Speech Act Theory

  • Proposed by Austin and Searle.
  • Every utterance performs an act:
    • Locutionary act: The literal meaning.
    • Illocutionary act: The intended action (request, promise, warning).
    • Perlocutionary act: The effect on the listener.
  • Example: "Can you pass the salt?" is a request, not a yes/no question.

b) Implicature

  • Based on Grice's Cooperative Principle and maxims (Quantity, Quality, Relation, Manner).
  • Speakers often imply more than they literally say.
  • Example: "It's getting cold in here" implies "Please close the window."

c) Presupposition

  • Information that is assumed to be true before an utterance is made.
  • Example: "Have you stopped cheating?" presupposes the person was cheating.

d) Deixis

  • Words whose interpretation depends on context (time, place, person).
  • Types: Person deixis (I, you), Place deixis (here, there), Time deixis (now, then).

e) Dialogue and Conversation Management

  • Analyzes turn-taking, topic management, and conversational implicature in dialogues.
  • Important for building chatbots and dialogue systems.

3. Importance in NLP Applications

ApplicationDiscourse/Pragmatic Role
Machine TranslationMaintaining coherence across sentences
ChatbotsUnderstanding intent beyond literal words
Sentiment AnalysisDetecting sarcasm and implied meaning
Text SummarizationIdentifying key discourse segments
Question AnsweringResolving references and context

Summary

Discourse analytics focuses on structure and coherence of text across sentences, while pragmatic analytics focuses on contextual and intended meaning of language. Both are essential for building NLP systems that truly understand human language rather than just processing words in isolation.

Open this answer on its own page →

Ambiguities in natural language

2079 · 5 marks

Explain the different ambiguities related to NLP. [5]

Ambiguity is one of the fundamental challenges in NLP. It occurs when a word, phrase, or sentence can be interpreted in more than one way. Since human language is inherently ambiguous, NLP systems must be designed to resolve these ambiguities for accurate understanding. --- Occurs when a single w...

Open this answer on its own page →

0 · 5 marks

What types of ambiguities does NLP suffer with? Describe. [5]

Ambiguity is one of the fundamental challenges in NLP. A sentence or phrase is said to be ambiguous when it can be interpreted in more than one way. NLP systems must resolve these ambiguities to understand and process natural language correctly. --- A word has multiple meanings and the correct me...

Open this answer on its own page →

NLP steps and pipeline

2080.2 · 5 marks

Explain the different steps in NLP. [5]

--- NLP is a subfield of Artificial Intelligence that enables computers to understand, interpret, and generate human (natural) language. --- - Involves identifying and analyzing the structure of words. - The text is divided into tokens (words, sentences, paragraphs). - Removes punctuation, whites...

Open this answer on its own page →